Skip to content

Instantly share code, notes, and snippets.

@brunogama
Last active December 15, 2015 11:38
Show Gist options
  • Save brunogama/5254021 to your computer and use it in GitHub Desktop.
Save brunogama/5254021 to your computer and use it in GitHub Desktop.
This Gist is for all who want to know the User's default browser using the Mac Terminal.
#!/usr/bin/env bash
# Author: Bruno Gama
echo $(basename "$(mdfind "kMDItemCFBundleIdentifier == '$(/usr/bin/plutil -convert xml1 -o - ~/Library/Preferences/com.apple.LaunchServices.plist | grep -B 3 "<string>http</string>" | tail -3 | head -n1 | sed -e 's/<[^>]*>//g' | sed 's/[[:space:]]//g' | tr -d '\040\010\012\015')'cd")" | sed s'/.app$//')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment