When you click a link in OS X, be it a Web link or a mailto link for sending an e-mail, OS X will open the default program that is associated for handling this type of link. In a fresh OS X installation, these will be set to Safari and Mail, but you can use any program that is capable of managing these links.
As with handling files of a particular type, OS X uses its launch services feature to associate links to programs as well. In the case of Web content, hyperlinks are simply referred to as “public.html” content, which is then linked to a relevant browser in the system’s launch services. Whenever this content is opened directly (ie, you click a link in an e-mail), the launch services will open the browser and send the content to it for handling.
You can see all of the current associations in your system by viewing the system’s lsregister database, which can be done in two ways:
- For Terminal-savvy users who have the OS X locate database enabled (), you can run the following command to view the lsregister database in a text file:
`locate lsregister` -dump | open -fe
- For those without the locate database enabled, you can run the following command (copy and paste both lines as-is):
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Laun\ chServices.framework/Versions/A/Support/lsregister -dump | open -fe
- Another option is to look at the LSHandlers entry in the launch services property list, which can be done by opening the file in the /Library/Preferences directory, or by running the following command:
defaults read com.apple.launchservices LSHandlers | open -fe
The resulting file that opens in TextEdit will be rather large (smaller for the third option), but if you scroll all the way to the bottom, you will see a list of handlers that show extensions or content type and the programs (designated by the keyword “Roll”) associated to each. For example, the extension “public.mp3” will likely be associated with “com.apple.iTunes” to indicate Apple’s iTunes program as the handler.
For Web and e-mail links, you can peruse this list and locate content type “http,” “https,” and “mailto” to see what handlers are associated with them.
Unfortunately the adjustment of this database cannot be done effectively in the Terminal, and instead requires you to do so from a program like the Finder where you can set the default program for a file (or all files of similar type) in the file’s information window. The same goes for associating Web browsers and e-Mail clients for handling hypertext and mailto link types.
In some programs like Firefox, there may be a built-in setting for making this program the default handler of a specific content type. If you go to Firefox’s “Advanced” settings, for instance, you will see a button to set it as the default browser, and then a checkbox to have the program automatically check for this association when it is launched.
This may be the case for Firefox, Apple’s built-in programs for handling Web and email links (ie, Safari and Mail) do allow you to set any program of your choosing as the default handler for these contents. For selecting a default Web browser to use, open Safari and in the General section of its preferences, you can select either a detected browser or any other application of your choosing as the program for handling http and https content.
Likewise, you can use Apple’s Mail program to set any e-mail client of your choosing for handling mailto links. To do this, as with Safari you just need to go to Mail’s preferences and choose a default email reader from the drop-down list.
Since other programs you have may not contain the ability to set default applications in this manner, even if you do not use Safari or Mail, they may be required to use periodically for making these changes. This might be especially true if your preferred application does not have an option to change link associations itself.
For apps that don’t have a default handler option, maybe the old preference pane, Default Apps is a good alternative.
Don’t get me wrong, I like Safari but Google Maps don’t load very well lately in the browser. I have considered moving over to Google Chrome where maps open faster than Safari but Chrome has a real lousy time on my Mac to enter text. You have to wait till hell freezes over (forever in computer time these days) before you can. Since jumping onto the Mac bandwagon 7 years ago I have been using a System Preference app called Default Apps to change the default app to some else if the need arises.
I already knew how to set the default apps in Safari and Mail, but I was interested to see what Terminal solutions Topher would offer. I was surprised to see that there was no Terminal answer for the question of browser and mail defaults. What’s more puzzling is that there is no way to set them in System Preferences, where, in my opinion, they logically belong.