Command line tool for setting the default browser (HTTP handler) in macOS.
Build it:
make
Install it into your executable path:
make install
COMMANDS:
-ls, list list all available HTTP handlers and show the current setting
-g, get print the current browser
-h, help show this screen
set <BROWSER> set the default browser to <BROWSER>
EXAMPLES:
defaultbrowser set chrome
defaultbrowser set "google chrome"
defaultbrowser set com.google.chrome
list all available browsers and show the current setting
$ defaultbrowser list
firefox
chrome
* safari
set the browser to chrome
$ defaultbrowser set chrome
print the current browser
$ defaultbrowser get
safari
The code uses the macOS Launch Services API.
MIT
Forked from kerma/defaultbrowser