Skip to content

Command line tool for getting and setting a default browser (HTTP handler) in macOS

License

Notifications You must be signed in to change notification settings

kerma/defaultbrowser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

defaultbrowser

Command line script for getting and setting a default browser (HTTP handler) in Mac OS X.

As there seems no other elegant way of doing it you need some Objective-C code.

The code uses Launch Services. More info on Launch Services Reference

Build

  1. Build it.
cd defaultbrowser
xcodebuild -project defaultbrowser.xcodeproj -alltargets -configuration Release
  1. Move it into your path (replace ~/bin to whatever you like)
cp build/Release/defaultbrowser ~/bin/

Usage

Open the XCode project and build it or download the build/defaultbrowser and put it somewhere in your path. chmod +x defaultbrowser is probably also necessary.

You can set the default browser with:

defaultbrowser -set chrome

Running defaultbrowser without arguments shows the current setting.

License

MIT

About

Command line tool for getting and setting a default browser (HTTP handler) in macOS

Resources

License

Stars

Watchers

Forks

Packages

No packages published