Google Chrome Profiles on OSX (Old)

Update

This guide is now obsolete, and you should use built-in support for multiple profiles in Google Chrome.  This document is saved here for posterity only.

Introduction

The following is a short guide to setting up multiple profiles for Google Chrome on Mac OSX.

Replace text that appears as {profile} with whatever is appropriate for your particular profile name.  See important warning below on valid profile names.

Note: this guide assumes that you installed Google Chrome in /Applications/, and that the profile data should be saved under ~/Library/.

Creating the shell script:

$ mkdir ~/bin/
$ cd ~/bin/

$ emacs google-chrome-{profile}

Enter the following text, substituting your profile name as desired:

#!/bin/zsh

PROFILE_NAME="{profile}"
GOOGLE_CHROME="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
USER_DIR="/Users/$USER/Library/Application Support/Google/Chrome/${PROFILE_NAME}"

exec $GOOGLE_CHROME \
    --enable-udd-profiles \
    --user-data-dir=$USER_DIR &

Make the script executable:

$ chmod +x google-chrome-{profile}

Warning:  Due to an issue in Google Chrome, the {profile} name must include only a subset of ASCII characters.  Known to be safe are are [a-zA-Z0-9_\-].

If you see the following error when installing Chrome extensions or applications, please change the {profile} string above to use only the safe subset:

Could not create directory for unzipping: /Users/
/Library/Application Support/Google/Chrome//Temp/scoped_dir_ …/CRX_INSTALL

Confirm that the new profile works from the command-line:

Run:

$ ~/bin/google-chrome-{profile}

A new Google Chrome instance should now launch and execute the first-run script.  If this does not happen, please debug before proceeding.

Creating the application launcher:

$ cd ~/Applications/
$ mkdir -p "Google Chrome ({profile}).app/Contents/MacOS/"
$ ln -s ~/bin/google-chrome-{profile} \
    "Google Chrome ({profile}).app/Contents/MacOS/Google Chrome ({profile})"

Confirm that the new application works from the Finder:

Open the ~/Applications folder in the Finder and double click on the Google Chrome ({profile}) icon.  

Note: the icon will appear as generic executable for now.

Change the icon of the new application:
  1. Single click on the new application in the Finder and Get Info ⌘I
  2. Find a file from which to copy the new icon and Get Info ⌘I
  3. Copy ⌘C the icon from upper left of the source file
  4. Paste ⌘P it into the icon on the upper left of the new application
Change the theme of the new Google Chrome profile:
  1. Launch the new application
  2. Click Chrome > Preferences ⌘,
  3. Click Get Themes and select a new theme for the profile
Repeat as desired:

Create as many profiles as you like, changing the name of the script and the application, modifying the shell script accordingly, and setting unique icons.

Rejoice:

The new application can be dragged to the dock or the Desktop and run just like any other OSX application, or run from the command line as needed.


Comments