Running Multiple Separate Simultaneous Chrome Processes

Reading time ~4 minutes

Even before BYOD further blurred the lines between work and home life, employees used their corporate supplied devices for personal use. Regardless, keeping personal browsing separated from work related browsing is a good idea. Perfect hygiene would dictate using different computers for personal and corporate use, that’s rarely ever happens. There are a number of different ways you can use the same computer for both personal and corporate browsing including having separate accounts on the machine (if you have permissions), running personal stuff in a virtual machine, or running different browsers for each purpose.

The last is probably the easiest and I have a co-worker who claims to run 5 different browsers on his laptop just for this purpose. Mind you, there are a lot of other reasons for wanting to run different browsers for different purposes. You could be running different browsers for testing, performance, and security reasons. I’m not going to delve into that. I’m just focusing on using the same browser for different tasks that are isolated from each other.

In this case I’m using Google Chrome and I want to use it for both personal and work-related browsing. I also need to make sure to keep the activities of one isolated from the other. Using private browsing for personal stuff might suffice in many cases. Since I sync stuff among personal machines, though, private browsing won’t work. Instead, here’s how I run multiple instances of Chrome on the same machine at the same time.

The following are instructions for OS X, but should work similarly on a Linux desktop adjusting paths as necessary. I haven’t touched a Microsoft Windows PC in nearly a decade, so I have no idea how to pull this off there.

Initializing a New User Data Directory

Chrome stores user configurations, extensions, bookmarks, cookies, caches, stored forms, and other transient data in a user data directory. Knowing this, you can setup different data directories for each type of “user” while having just one Chrome binary installed. Here are the steps to get that going.

The default location for Chrome to store the user data is /Users/[username]/Library/Application Support/Google/Chrome/. I use this default for my work account. To create and initialize a new user directory perform the following tasks in a Terminal window.

  • export chromeApp="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
  • mkdir ~/Library/Application Support/Google/Chrome-personal
  • "${chromeApp}" --user-data-dir="/Users/andy/Library/Application Support/Google/Chrome-personal" >/dev/null 2>& Notice that in the quoted line in item 3 you need to use the full path to the data directory. Tilde (~) expansion will not work within the quoted string.


The last command should start up a new Chrome browser. First Chrome will pop-up with a “Welcome to Google Chrome” window. Upon clicking “Start Google Chrome” it will populate the Chrome-personal directory with initial user data, and then bring forward a browser window. This will ask you to log into Chrome. Whether you do that is up to you.

With the new Chrome window open, you will need to install any extensions, bookmarks, etc you want to customize this browser. I would highly suggest setting a theme to this window so that it is easily visually different from any other copies of Chrome you might run at the same time.

Lather, rinse, repeat for any additional entities you’d like to create.

Startup Script

I wrote a simple shell script to start my browsers up with the requisite user directories. Since Chrome is set as the default browser on my system, it is important to note that the first Chrome process started will be the one that gets used for opening new links from other applications. In the example below, this makes my personal session the default for new tabs/windows from other applications.

Chromes.sh – gist link

#!/bin/sh
## Chrome App
app="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"

## Non-default user data directories
usrDir="/Users/andy/Library/Application Support/Google/Chrome-personal"

## Fire up Chrome
"${app}" --user-data-dir="${usrDir}" >/dev/null 2>&1 &
"${app}" >/dev/null 2>&1 &

## If Chrome is default browser, then the first process fired will be
## where new links/tabs are spawned from other applications.

Remember to chmod u+x chromes after you are done editing.

You can now fire off this script from any open Terminal window. Or you can do the following to make it run when double-clicked in the Finder.

Make a Shell Script Run Like a Native App

In your Terminal window perform the following:

  • mkdir -p ~/Applications/Chromes.app/Contents/MacOS
  • copy your shell script to ~/Applications/Chromes.app/Contents/MacOS/*

    e.g. cp Chromes.sh ~/Applications/Chromes.app/Contents/MacOS/

  • open ~/Applications/Chromes.app/Contents/MacOS/ Chromes in Finder
    Chromes script in Finder
  • In the Finder window that opens, select Chromes.sh and type ⌘-i to open the information pane for the shell script. Then change Open with to Terminal.app. Chromes Finder Info panel: Open With
    Open with Terminal.app
  • Run open ~/Applications to open a Finder window with the local user Applications. Chromes.app in Finder
    Chromes.app in Finder
  • Select Chromes.app in Finder type ⌘-i to open the information pane for the Application. Download and open in Preview the following png file. In Preview select all (⌘-a) and copy (⌘-c) the image. Then select the Icon at the top of the Application Information pane and paste the image (⌘-v). You will see the size of the application change and after a few seconds the Icon for Chromes.app will change as well.

    Chromes.app Finder Info
    Chromes.app Finder Info

  • You can now double-click the Chromes.app and fire up your multi-Chrome browsers. You can also drag the Application Icon from the Finder into your Dock for future use.


Example Icon


The Results:

Two Different Chrome Processes
Two Different Chrome Processes

Alcohol content: low (clearly huffing glue)

piTravel Clock Build

![da clock](/images/posts/2018-travel-clock-sm.jpg)Setting a clock should be a thing of the past. There are enough radiosignals bouncing...… Continue reading

Let's Encrypt Gitlab Again...

Published on July 25, 2018