How Interesting...
July 5, 2019

Running multiple Firefox profiles simultaneously on a Mac

Posted on July 5, 2019  •  3 minutes  • 608 words
Table of contents

I’ve been a big fan of the Firefox browser for a long time now. It’s fast, open source, secure and feature rich. However, one feature still eludes it - being able to run multiple instances simultaneously with differrent profiles. Chrome has long had the feature, which can be conveniently accessed through the profile switcher. As can be seen below, this too is possible with Firefox but Mozilla don’t make make it so easy.

You could be forgiven for wondering why this somewhat niche feature is required. Firstly it’s a good idea to keep your work and personal browsing separate. It can be fairly annoying (and in some cases anxiety inducing) to see adverts relating to work appearing in your downtime which can impact on your work-life balance and ability to disconnect. Similarly, personal browsing habits may lead to distractions at work. Secondly you’ll almost certainly need different browser addons. Work and personal life often requires very different feature-sets from your browser, and too many installed addons can severely impact on your browsers’ performance. It’s a good idea to split them out, and the way you do this is with different profiles. Another reason is website logins - there may be some sites which you have a personal and work account for, and to save you logging in and out as you start or finish work for the day can be somewhat laborious if there’s several.

In this article, we will explore how to create a new profile, and also how to run the default and new profile simultaneously on the same Apple Mac.

Creating an additional profile

The default Firefox profile is simply named “default”. If you only have one profile this is the one which starts when you start the browser. You can observe and create profiles through Profile Manager within the browser itself.

  1. In Firefox, type about:profiles in the address bar
  1. Click continue to dismiss the introduction and you’ll be able to set a name for your new profile. Notice here the location of the profile on the Mac’s filesystem.

  2. Click done and your profile is created. You can now switch to this profile and customise it to taste by clicking the “Launch Profile in new browser” button in the Profile Manager.

If you’re happy with starting and switching profiles through the GUI, you’re done. Personally, I’d rather launch it through the terminal.

Launching through the terminal

If you prefer launching your profiles through the terminal, you can do that too.

  1. Obtain the path to the profile you wish to launch from the Profile Manager in about:profiles It’ll look similar to this:

/Users/chris.gillatt/Library/Application Support/Firefox/Profiles/54qewttc.Chris

  1. Construct an expression like so, replacing my profile for your own:

nohup /Applications/Firefox.app/Contents/MacOS/firefox -no-remote -profile /Users/chris.gillatt/Library/Application Support/Firefox/Profiles/54qewttc.Chris &>/dev/null &!

Explanation

Argument Description
nohup prevent hangup (end process) when you close your terminal window
-no-remote ignore the existing Firefox process if there is one
-profile specifies your new profile other than the default one
&>/dev/null forward errors and logs to nowhere
&! Send the process to the background and disown it, so that it continues to run

Creating an alias

You can then place this into your .zshrc or .bashrc for convenience:

# Profile 1
firefox_profile_1='nohup /Applications/Firefox.app/Contents/MacOS/firefox -no-remote -profile /Users/chris.gillatt/Library/Application Support/Firefox/Profiles/54qewttc.Chris_work &>/dev/null &!'

# Profile 2
firefox_profile_2='nohup /Applications/Firefox.app/Contents/MacOS/firefox -no-remote -profile /Users/chris.gillatt/Library/Application Support/Firefox/Profiles/54qewttc.Chris_personal &>/dev/null &!'

Launching the profile using the alias

Once the alias is created, you’ll be able to launch your profiles from your terminal like any other commandline utility, without needing to type all of the arguments manually like so:

1firefox_profile_1

If your alias is not working, open up a new terminal window to load in your changes to your *rc file.

Socials / Links

I tweet tech, bad jokes and silly memes