MacOS – Default Browser .plist location

defaultsmacos

I have a custom built browser, lets say its similar to a firefox port such as Ice Weasel. I am wondering where I register this so that it will appear in the System Preferences > General > Default Browser menu.

I can view the current defaults on the command line from:

defaults read ~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist

However, this only seems to give me what is actually set as my defaults and not as what CAN be set as my defaults. It's the latter portion that I am interested in. What do I need to do in order to register my custom browser so that it can be set as the default?

I'm guessing there is a .plist file somewhere for that?

Best Answer

You don't add yourself to this plist—OS X manages this itself. For example, download a new browser and copy it to the Applications folder. Without opening it once, OS X will add it to the list in System Preferences.

This is achieved with the following in the Info.plist in the app:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLName</key>
        <string>http URL</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>http</string>
        </array>
    </dict>
    <dict>
        <key>CFBundleURLName</key>
        <string>Secure http URL</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>https</string>
        </array>
    </dict>
</array>