shortcut to launch a specific firefox profile on mac

For as long as I've been working on Mozilla projects, it's always been a breeze to create Windows shortcuts to the Profile Manager or to a specific profile. You simply created a desktop shortcut and added -profilemanager or -P name to the end of the shortcut's path.

Mac doesn't do shortcuts like Windows. While it does have aliases, you can't modify them like you can shortcuts on Windows. So, for years, I and many of my friends and colleagues working on Mozilla projects, especially the less technically savvy of us in the QA and testing community, have resorted to the tedious process of launching the Mac Terminal and typing in something like /Applications/firefox.app/Contents/MacOS/firefox -profilemanager to launch the Profile Manager. Some more savvy of the group would save some of those keystrokes by creating a shell alias for that long-ish command. Still, involving the Terminal meant moving from the mouse to the keyboard and opening and closing a second program.

Thanks to some help and inspiration from my regular Mac Hero, Eric Shepherd, I can share with you all a super-simple way to create a "shortcut" on Mac so that you can just double-click a Desktop or Dock icon to launch the Firefox Profile Manager or even a specific Firefox profile.

I'm going to use some scary (to me, at least) words and phrases but don't be turned off, it's actually really simple. We're going to write a small AppleScript to do the work that we were doing manually in the Terminal. That's it. Don't be like I was and turn away at the first mention of writing script ;-) I promise this is really, really easy.

Step 1: Open the Script Editor

If you're like me you probably haven't ever done this before, or if you did, it was an accident :-) To launch the Script Editor, simply open a Finder window and navigate to Applications -> AppleScript -> Script Editor. Double-click on the Script Editor to launch.

Alternatively, you can just hit Command+Space to active Spotlight and then type "script e" and hit Enter.

Step 2: Write some AppleScript

The good news here is that the AppleScript can actually be very simple. The even better news is that I'm not even going to ask you to write it. You just have select, copy, and paste this text into the Script Editor:

do shell script "/Applications/Firefox.app/Contents/MacOS/firefox -ProfileManager &> /dev/null &"

That's almost human readable :-) and it's pretty clear that it's simply doing for us what we used to do manually in the Terminal. The odd bits at the end are saying something like "just do what I said and don't tell me about it".

Step 3: Save your new AppleScript

Now that you've written ;-) the AppleScript, you need to save it. Select File -> Save As... and you'll be prompted with the normal options to give it a title (Save As: text field) and a location (Where: selection). I named my AppleScript "Firefox Profile Manager" and selected my Applications folder as the location.

Since we want this script to actually run when we double-click it, rather than opening back up in the Script Editor, before pressing Save we need to change the File Format from Script to Application Bundle. Don't mess with any of the Options check boxes. They're not relevant here.

Step 4: Optional Sexy

You're actually done already. You can double-click your new AppleScript Application and it will launch the Firefox Profile Manager. But there's one more step I like to do and that's to give it a better icon.

If you haven't done this before, it's really simple. Just right-click on your new Firefox Profile Manager's icon and select Get Info. Now go to your Applications folder, locate your actual Firefox, and just drag and drop the Firefox icon right on top of little AppleScript icon in the top left corner of the Get Info window. That's it.

Now you can just double-click on your sexy new Firefox Profile Manager icon and it'll start the Firefox Profile Manager. For quick access, you can drag that icon to your Dock and it'll create a nice launcher there, too.

But what if you want to bypass the Profile Manager all together? No problem!

To launch specific Firefox profiles, you can follow the exact same process as outlined above, except you'll use Firefox's Profile name option rather than the Profile Manager option. You simply paste do shell script "/Applications/firefox.app/Contents/MacOS/firefox -P name &> /dev/null &" into the Script Editor (replacing name with the actual name of your profile,) and you've got yourself a shortcut that opens Firefox with a specific profile.

I hope this helps some of you Mac Firefox users and testers out there struggling with multiple Firefox profiles.

Oh, and if you've got a better or easier way of accomplishing this, or any corrections to my instructions, please let me know in comments.

reactions, thoughts, comments, etc.

one way on mac w/out using applescript:
- open terminal, navigate to firefox folder, and do ./firefox -P just once.
- when Profile Manager launches, uncheck the "Dont ask at startup" box
- Next time, just click on the firefox icon wherever you saved it in appdir. Choose your profile each time.

Tchung, yeah. That's right. Maybe I should have used the "launch Firefox with a specific profile" example as the primary one since that's what I was really after here. However, if you only occasionally need to use a separate profile, I think there's still lots of value in the AppleScript approach because you won't be prompted every time with the Profile Manager.

- A

Another way to do this is using the Automator application.

1) Open Automator
2) Double click on Run Shell Script
3) Paste the shell command (in this case: /Applications/Firefox.app/Contents/MacOS/firefox -ProfileManager &> /dev/null &)
4) Save as Application.
5) Optionally fix the icon. The drag and drop never worked for me, so in my case I open the package and edit the icon file directly.

Except for step 5, I think this is a little friendlier for people who don't want to learn about AppleScript.

Jorge, yeah. That's actually the first way I did this but it leaves the Automator running in the Dock, as far as I can tell. The only way I found to make the Auotmator Dock icon go away was manually editing the package's plist file. That seemed a bit excessive compared to just writing the AppleScript "manually".

Any suggestions about how to make the Automator go away after the action is completed? It's like it needs a "shutdown self" or something like that.

- A

this is a good start.. now in windows if you do something like this...

firefox.exe -p -no-remote

you can open multiple profiles at the same time... So I have one session for browsing and another that acts as a Twitter/Social networking client... and another that is an alarm clock.. and another that acts as a testbed for new add-ons, etc, etc...

if you can do that an a Mac too.. then you are really getting somewhere.

this is a good start.. now in windows if you do something like this...

firefox.exe -p -no-remote

you can open multiple profiles at the same time... So I have one session for browsing and another that acts as a Twitter/Social networking client... and another that is an alarm clock.. and another that acts as a testbed for new add-ons, etc, etc...

if you can do that an a Mac too.. then you are really getting somewhere.

Asa: the & at the end of the command does the trick. That tells the terminal process (controlled by Automator) to run the command in a separate process. This way Automator exits immediately.

Jorge, thanks! I'll probably put together an update since I have that all written out (Automator was how I first tried this.) Maybe I'll do a screencast :-)

-A

Minor correction: "just drag and drop the Firefox icon right on top of little AppleScript icon in the top right corner of the Get Info window"

the icon is in the top-left corner

Thanks a lot for this tip.

Marius, thanks for that catch. Correcting.

- A

Thanks!

Launching a specific profile really helps me out. The window isn't automatically focused though. (From what I read applications launch hidden in 10.5 so as to not disrupt)

I taught myself some AppleScript to get Firefox to focus. I learned to use the activate keyword. But activate will try to launch Firefox if it hasn't launched yet. Firefox won't be fully launched if I use activate immediately after the command to start Firefox, so activate will try to launch another instance of Firefox.

Using the delay keyword didn't always work because Firefox can take different amounts of time to launch each time.

So this is what I ended up doing:

focusit()

on focusit()
tell application "Firefox"
if it is running then
activate
else
my focusit()
end if
end tell
end focusit

(If you are using Automator then you can add this code in a Run AppleScript action after the Run Shell Script Action)

Please let me know if there is a better way.

-mws

Unfortunately, my AppleScript can fail with a stack overflow if Firefox is slow to load.

I'm still learning AppleScript thanks to Asa. :)

This is my second try to bring focus Firefox after launching and it seems to work all the time for me.

repeat until application "Firefox" is frontmost
if application "Firefox" is running then tell application "Firefox" to activate
end repeat

Asa, you're my hero! I could not find an elegant way to do this. Thanks a bunch!

--Tristan

am not geek of mac but trying to be one and i have recently devloped a combination of apple script and automator with self shutting down if you want i can mail it or even send you the script

am not geek of mac but trying to be one and i have recently devloped a combination of apple script and automator with self shutting down if you want i can mail it or even send you the script

am not geek of mac but trying to be one and i have recently devloped a combination of apple script and automator with self shutting down if you want i can mail it or even send you the script

Thank u so much Asa
I've been looking for this since many weeks ago

and for Clay, its quite simple
just put -no-remote after your profile's name and its done.. :)
it's similar with windows shortcut

Thank u so much Asa
I've been looking for this since many weeks ago

and for Clay, its quite simple
just put -no-remote after your profile's name and its done.. :)
it's similar with windows shortcut

Sorry to be soooo excited, but I just about lost it when I searched "firefox profile launch app for mac" and found your page. I KNEW that AppleScript thing had to be good for SOMETHING. Thank you so much for writing this tutorial. You have saved me much cursing and extra keystrokes and mouse clicks.










Remember personal info?