Nikolas Knickrehm

5 min read

Quickly Switch Between Accounts in Firefox on a Mac

Remote Work

As a consultant I am in the situation of working for two different organizations at the same time. While I spend most of the day working for my current client, I also have some meetings and use some systems of my consultancy company Netlight.

Quickly Switch Between Accounts in Firefox on a Mac

Some of the more annoying aspects of working with these two hats on, is when I need to switch contexts quickly. Usually this is not a mental issue but rather a technical one since nowadays most companies have some form of Single Sign On (SSO) in place which stores a session in your web browser. Now when you are visiting a web page or try joining a meeting of one company while you are logged in to the account of the other company you will often see error messages.

I am not sure how many times I ran into this issue yet but it always takes me some time to finally get to my destination and during the past few month I tried different approaches of mitigating the problem. Hopefully you can use some of my insights!

Before coming up with my now preferred solution of having a dedicated Firefox profile for each company plus a self-made script / app for quickly switching between them, I tried out some other approaches:

Using two separate user accounts or devices

Are the cleanest options for obvious reasons. Creating as little as possible overlap between both organizations is always desirable from a security perspective. Still not every company will hand out a laptop to each consultant plus it can slow you down a lot if you just need to quickly switch your hats and do something for the other company in between meetings. Especially using two separate accounts on the same device is really annoying and it can take up to a few minutes to switch between them.

Using two different web browsers

Is a viable option but can drive you crazy. One reason for that is, that the number of good web browsers on the Mac is rather limited. My trust in Google Chrome is completely destroyed (https://chromeisbad.com/) and while Safari is great if you just want to browse the web, some web applications are only supporting Firefox and Chrome.

If you are like me and use your web browser with the brain on autopilot switching between two browsers can be confusing as hell especially when you are using one of them far more often than the other one.

Using private tabs for one organization

When you are using the login from one company very rarely, it can be sufficient to just switch into a private tab/window and quickly do the task at hand without destroying the login in the main browser windows.

Using "Multi-Account Containers"

There is a rather new plugin for Firefox allowing you to create containers in which tabs can operate isolated from tabs belonging to other container. The idea is that things like cookies, which are essential for SSO to work, are only available to tabs belonging to the same container. This allows you to be logged in to different accounts simultaneously even on the same website in one browser window.

Firefox Multi-Account Containers – Holen Sie sich diese Erweiterung für 🦊 Firefox (de)
Laden Sie Firefox Multi-Account Containers für Firefox herunter. Firefox Multi-Account Containers lets you keep parts of your online life separated into color-coded tabs that preserve your privacy. Cookies are separated by container, allowing you to use the web with multiple identities or accounts s…

Tabs also have visible indicators (colored border) so you can see which tab is belonging to which container. You can also configure certain website to always load in a specific container or reload a website in another container.

Source: https://blog.mozilla.org/en/products/firefox/introducing-firefox-multi-account-containers/

While I really love the idea and sometimes use this as a fallback when I need to do something very quickly, I still prefer a more isolated approach:

Using different browser profiles

Is supported in browsers like Firefox and Chrome. These are essentially different instances of the same browser that you can use as if they were different browsers. So it is possible to be logged in to the same web page multiple times with different users. You can also have different sets of bookmarks, saved passwords and add-ons plus your browser histories are stored separately.

This is my preferred option but switching between these profiles can be a bit annoying. For Windows and Linux users there is the add-on Profile Switcher for Firefox which allows you to switch quickly between profiles through the UI. Unfortunately this add-on does (as of writing this) not support macOS.

This is why I have created my own little helper app that sits in the Dock which can start another Firefox profile with a single mouse click. You can copy the code and create such app on your own without any coding skills 🤗

Creating your own Firefox profile switcher

Using the macOS built in Script Editor you can create a script that launches a specific Firefox profile. You can manage these profiles when you go to the page about:profiles in your browser. Make sure to create one and remember its name before you continue.

Just create an empty script in the Script Editor and paste in the following code:

do shell script "/Applications/Firefox.app/Contents/MacOS/firefox-bin -p netlight > /dev/null 2>&1 &"

You must replace netlight with the name of the profile that you want to launch. Try out the script using the ▶️-button in the Script Editor UI. If a new Firefox window was opened up your script is ready to be exported as a macOS application.

In the menu click File > Export... and select the File Format Application like shown in the screenshot below before hitting the save button.

Export the script as a macOS application
Export the script as a macOS application

Now you can navigate to the app that was exported and drag it into your Dock. Congratulations, you can now launch a Firefox profile using a single mouse click. Repeat these steps for each of the profiles you want to have in your Dock.

Personally I configured the profile for my current client as the default in Firefox so that the browser would normally load it. Additionally I created two profiles and “profile switchers” for Netlight and personal stuff.

Next up

Want to stay up to date?