Mac OS X

Programmatically Changing the Mac OS X Browser

I am starting to get a lot questions on how to change the default browser for Mac OS X. I don’t know if it’s in preparation for summer imaging or if it’s because people clicked the button to reset their default browser to Chrome and then realized that, while fast, it just isn’t Safari. Either way, the default browser is stored in the com.apple.LaunchServices.plist, inside the LSHandlers array. Now, changing this with a defaults command would involve copying all the information into said command and then dumping it back in after changing all entries of com.apple.safari to the information for the browser you actually want to use. If you do that, look for the following keys:

LSHandlerRoleAll = “com.apple.safari”;

LSHandlerRoleAll = “com.apple.safari”;

LSHandlerRoleViewer = “com.apple.safari”;

LSHandlerRoleViewer = “com.apple.safari”;

LSHandlerRoleAll = “com.apple.safari”;
LSHandlerRoleAll = “com.apple.safari”;
LSHandlerRoleViewer = “com.apple.safari”;
LSHandlerRoleViewer = “com.apple.safari”;

These may say something like com.mozilla.firefox for now and you want to change them to something different, like com.google.chrome. Either way, you can do it by augmenting the entire contents of the array, which would replace the contents of the file or using PlistBuddy, which could be used to more granularly alter each setting.