I often switch my default browser between Safari and Chrome. I would like to create a shortcut that will launch the default browser, whatever that may be. This way I don't have to remember what my default browser is and switch between typing "Chr" or "Saf" in spotlight. I would like to type the same word such as "Browser".

What are my options?

3 Answers 3


I'd make a little AppleScript that does this:

on GetDefaultWebBrowser()
    set _scpt to "export VERSIONER_PERL_PREFER_32_BIT=yes; " & "perl -MMac::InternetConfig -le " & "'print +(GetICHelper \"http\")[1]'"
    return (do shell script _scpt)
end GetDefaultWebBrowser
do shell script "open -a \"" & GetDefaultWebBrowser() & "\""

Replace the URL (in quotes) with your homepage. The rest of the code serves to figure out what your default browser is, and make it the active application. That part lifted from a Daring Fireball article.

Save it as an app called Browser and put it somewhere. Once Spotlight indexes it, you can type Browser in and hit enter. This will open the URL in your default browser.


Open AppleScript Editor from your Applications/Utilities folder (if you have older than 10.6, it will be Script Editor in your Applications folder). Paste that line in. Go to File-> Save As. Set the File Format: menu to Application. Choose a location and save.

  • Web addresses as home pages are so 90s ^^; (though some good landing pages nowadays do exist) I wish there would be something like about:home which would translate to the whatever homepage in the whatever browser. Feb 24, 2011 at 14:29
  • @koiyu I wanted to use about:blank (fast), but it didn't work for some reason. Feb 24, 2011 at 14:55
  • @Nathan open location "http://" opens about:blank (at least with Chrome). But blank isn't quite the same as home page. Feb 24, 2011 at 15:32
  • 1
    @koiyu Doesn't work for Safari. Fills in localhost. True, it isn't a homepage, but it tends to be faster. Feb 24, 2011 at 16:27
  • Sorry, I'm an OS X newbie. Could you please elaborate as to how I would create and save this file?
    – Senseful
    Feb 25, 2011 at 16:59

This may be too low tech of a solution for you but what about creating a web shortcut file (naming it "Browser") to say, your homepage, and then either putting that shortcut in your dock (and accessing it from there), or searching for that file via spotlight - when clicked the default browser would open.


Edit: Nathan edited his answer after I posted this, so mine seemed completely pointless. So I added the reopen verb — it's a bit tidier way to make sure that the browser doesn't open up with no windows.

Also, you don't have to save Applescripts as .app to run them from Spotlight — .applescript and .scpt also work

set a to do shell script "export VERSIONER_PERL_PREFER_32_BIT=yes; perl -MMac::InternetConfig -le 'print +(GetICHelper \"http\")[1]'"
tell app a
end tell

Original Perl script from a Daring Fireball post (!).

I've also been changing back and forth between browsers recently, but I just use F11 as a shortcut for a script that opens the main browser.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .