Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I am using Google Chrome version 22 on OS X 10.8. I use separate user profiles (created using the native Chrome facility in Settings->Users) for my "regular" web browsing, and the web development that I do. I launch my web development profile from the regular Chrome profile window by clicking on the avatar in the top-left-hand-corner:

enter image description here

At the moment both of these profiles share a single dock icon. However, I would much prefer for each Chrome profile to have its own dock icon, with the windows managed separately - and ideally for the dock icons to be distinguished in some way. Is this easily possible? By 'easy', I mean things like rebuilding Chrome from source are not an option I'll consider.

Note: I would like to use the same, stable, version of Chrome for both profiles. It would be OK to have the same version installed twice as long as they can be kept separate and the dock icon distinguished.

share|improve this question

4 Answers 4

up vote 3 down vote accepted
+50

For having two Chrome running at the same time you need to create a second runnable Google Chrome App.

You can create that second application by running the following script. It comes from this site, I copy and paste for readers' convenience:

#!/bin/bash

PROFILE_NAME=$1
mkdir -p "/Applications/Google Chrome $1.app/Contents/MacOS"

F="/Applications/Google Chrome $1.app/Contents/MacOS/Google Chrome $1"
cat > "$F" <<\EOF
#!/bin/bash

#
# Google Chrome for Mac with additional profile.
#

# Name your profile:
EOF

echo "PROFILE_NAME='$PROFILE_NAME'\n" >> "$F"

cat >> "$F" <<\EOF
# Store the profile here:
PROFILE_DIR="/Users/$USER/Library/Application Support/Google/Chrome/${PROFILE_NAME}"

# Find the Google Chrome binary:
CHOME_BIN="/Users/$USER/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
if [[ ! -e "$CHOME_BIN" ]]; then
  CHOME_BIN="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
else
  echo "ERROR: Can not find Google Chrome.  Exiting."
  exit -1
fi

# Start me up!
exec "$CHOME_BIN" --enable-udd-profiles --user-data-dir="$PROFILE_DIR"
EOF

sudo chmod +x "$F"

Save it in a file (let's say create_second_chrome.sh in the Desktop folder), open the shell and execute it by passing as parameter the profile folder you want to associate to the second Chrome App. It will be called Google Chrome profile_folder_name. Let's suppose Google Chrome Development:

$ cd ~/Desktop
$ . create_second_chrome.sh Development

Now you can launch the new version of Chrome (Google Chrome Development) from the ~/Applications directory. You can set a different icon by right-clicking on the app and selecting 'Get Info'. You will see that this new version has its own icon on the dock and can be docked there if needed.

share|improve this answer
    
That doesn't seem to work. I created a new profile for myself called Development in Settings -> Users. This created the directory ~/Library/Application Support/Google/Chrome/Profile 2. However, executing open -a "Google Chrome" --args --profile-directory="Profile 2" still opens the old/original profile, as I can tell from the avatar in the top-right corner. –  Andrew Ferrier Oct 11 '12 at 14:17
    
@AndrewFerrier Have you tried to close command + q Chrome and repopen it by means of the workflow? It works with me. –  Maverik Oct 11 '12 at 14:22
1  
it works if you do that, yes (i.e. if Chrome is not started at all, it opens the desired profile). But if one profile is already started, executing that command re-opens a window for that profile, irrespective of which profile is specified. That's doesn't help with the question, since the objective is to have both open simultaneously. –  Andrew Ferrier Oct 11 '12 at 14:27
    
@AndrewFerrier Thanks for your edit, now the answer it better! Hope it helped you! Luca –  Maverik Oct 12 '12 at 15:41
1  
neither am I now! Seems I made a mistake, it seems OK now. Will leave it running for a bit, see if I continue to experience problems... –  Andrew Ferrier Oct 12 '12 at 15:59

None of these answers worked for me in a comprehensive way under Mac OS X Yosemite. Here is my solution, which gives you multiple instances, a dock launch menu for the instances, and different icons for each instance. When you run the script it'll automatically go through all your profiles, and then tell you what to do next.

#!/bin/bash

# cdi.sh - Make chrome profiles behave like multiple browsers on Mac OS X
#          (Tested on Yoshmite). Make profiles work like seperate applications
#          - esp. useful if you want to easily switch between different browsers
#          in different virtual desktops / workspaces, or don't want work
#          windows mixed in with home windows in the "Window" menu, or want to
#          be able to easily see what processes are with a certain profile in
#          chrome task manager, or be able to eaisly quit one profile with
#          multiple windows open and start where you left of later.

set -e

cd /Users/$USER/Library/Application\ Support/Google/Chrome

CDI="cdi-chrome-multiple-profile-instances-in-dock-with-different-icons.d"
APPLESCRIPTS="$CDI/Applescript-Sources"
LAUNCHERS="$CDI/Chrome-Launchers"
RUNTIMES="$CDI/Chrome-Runtimes"
test -d $CDI || mkdir $CDI
test -d $APPLESCRIPTS || mkdir $APPLESCRIPTS
test -d $LAUNCHERS || mkdir $LAUNCHERS
test -d $RUNTIMES || mkdir $RUNTIMES

grep '"username"' Profile*/Preferences Default/Preferences | grep -v '               ' | awk -F : '{print $1";"$3}' | sed 's:/Preferences::g' | sed 's:\@:-at-:g' | sed 's/;\ /;/g' > $CDI/profiles.txt
# Like: Profile 1;"webmaster-at-example.org"

echo "Be patient, this involves copying a lot of data..."

while read PROFILE; do

DIR="$(echo $PROFILE | awk -F\; '{print $1}')"
# Like: DIR='Profile 1'
echo "Working on profile: $DIR"

LINK="$(echo $PROFILE | awk -F\; '{print $2}' | sed 's/\ /\-/g' | sed 's/"//g' | sed 's/^/cdi-profile-/g')"
# Like: cdi-profile-webmaster-at-example.org

APP="$(echo $LINK | sed 's/^cdi-profile-//g' | sed 's/$/-DO-NOT-RUN-DIRECTLY-JUST-USE-FOR-CHANGING-ICON-cdi\.app/g')"
# Like: webmaster-at-example.org-DO-NOT-RUN-DIRECTLY-JUST-USE-FOR-CHANGING-ICON-cdi.app

SHIM="$(echo $LINK | sed 's/^cdi-profile-//g' | sed 's/$/\.app/g')"
# Like: webmaster-at-example.org.app

TXT="$APPLESCRIPTS/$(echo $LINK | sed 's:^cdi-profile-:chrome-:g' | sed 's/$/\.txt/g')"
# Like:
# cdi-chrome-multiple-profile-instances-in-dock-with-different-icons.d
# /Applescript-Sources/chrome-webmaster-at-example.org.txt

test -L "$LINK" || ln -s "$DIR" "$LINK"
cd "$LINK"
test -L Default || ln -s . Default
cd /Users/$USER/Library/Application\ Support/Google/Chrome
test -d "$RUNTIMES/$APP" || cp -R /Applications/Google\ Chrome.app "$RUNTIMES/$APP"

## This section disabled because enabling it makes automatic profile login not work.
## There is a chance someone who knows more about chrome will help at some point; see:
## https://code.google.com/p/chromium/issues/detail?id=460787
## https://groups.google.com/a/chromium.org/forum/#!topic/chromium-discuss/0HEeMuh8WqA
## https://github.com/lhl/chrome-ssb-osx
# Change Bundle ID so desktop assignation works. Not sure if this will survive updates.
# CFBundleIdentifier must contain only alphanumeric (A-Z,a-z,0-9), hyphen (-), and period (.) characters.
# (Based on fiddling around there also seems to be a length limit.)
#UUID="$(echo $APP | md5sum | awk '{print $1}' | tr [0-9] [A-Z] | cut -c 1-4,29-32)"
#plutil -replace CFBundleIdentifier -string "cdi.$UUID" -- "$RUNTIMES/$APP/Contents/Info.plist"
#plutil -replace CFBundleName -string "$UUID" -- "$RUNTIMES/$APP/Contents/Info.plist"
#plutil -replace CFBundleDisplayName -string "$UUID" -- "$RUNTIMES/$APP/Contents/Info.plist"
#plutil -replace KSProductID -string "cdi.$UUID" -- "$RUNTIMES/$APP/Contents/Info.plist"
# To check: defaults read ~/Library/Preferences/com.apple.spaces.plist app-bindings

echo "on run" > $TXT
echo -n "do shell script " >> $TXT
echo -n '"' >> $TXT
echo -n "/Users/$USER/Library/Application\\\\ Support/Google/Chrome/$RUNTIMES/$APP/Contents/MacOS/Google\\\\ Chrome --user-data-dir=/Users/$USER/Library/Application\\\\ Support/Google/Chrome/$LINK" >> $TXT
echo ' > /dev/null 2>&1 &"' >> $TXT
echo "quit" >> $TXT
echo "end run" >> $TXT
test -d "$LAUNCHERS/$SHIM" || osacompile -o "$LAUNCHERS/$SHIM" $TXT

done < $CDI/profiles.txt

echo
echo 'Done with automated portion. Now you should manually:'
echo
echo '1. Add (identical) icons of your choice to each pair of profile Launchers'
echo '   / Runtimes in the folder ~/Library/Application Support/Google/Chrome/'
echo '   cdi-chrome-multiple-profile-instances-in-dock-with-different-icons.d'
echo '   (google for numerous guides on how to change mac os x app icons)'
echo
echo '2. From the finder, drag the "Chrome-Launchers" folder to the stacks area'
echo '   of the dock. Right click on the stack and select "List" for easy viewing.'
echo '   Also select "Display as Folder" and give the folder a nice icon.'
echo
echo '3. BE SURE to only open Chrome via this stack. DO NOT pin the app-area'
echo '   Chrome icon(s) to the app area of the dock! DO NOT run "normal" Chrome!'
echo
echo 'The only exception to (3) is if you need to add a new profile. In that case,'
echo 'close all instances, then open the "normal" Chrome, add profile, close, and'
echo 'then run this script again.'
echo
echo 'Note: when you launch first time you will get "Welcome to Google Chrome"'
echo '      dialog box. This is normal; do not worry. It will ask if you want'
echo '      to set Chrome as default; this applies to that instance of chrome.'
echo '      Choosy - http://www.choosyosx.com/ - works great with this!'
echo

For icons, you can use any PNG (or probably many other formats).

The chrome avatars which you may already be used to are located under "~/Library/Application Support/Google/Chrome/Avatars" - avatar_ninja.png etc.

Or make your own, or use one of the numerous icon sites - I like Easyicon.

Also this looks possibly useful - How to Get Back Avatars in Chrome to Switch User Profiles More Easily - to make the open windows easier to quickly identify (untested).

One thing that isn't working yet is the ability to assign different user profile chrome instances to specific desktops. This is because if the attribute used to do this is changed, the browser is no longer able to automatically log in to that profile when the browser starts up. I've made a forum post and bug report on this issue; it is also a problem for site-specific browsers, so the chrome-ssb-osx project may get this working at some point. I don't have the 10 reputation points needed to include more than 2 links in posts here (help! :-), so you'll have to look at the links to these things in the script above ("This section disabled" section).

share|improve this answer
    
Since this is getting a bit complex, new stuff will all go to github.com/djbclark/chrome-apartheid –  Daniel J Clark yesterday

I tried the script from @Maverick and it partly worked (thanks!) but I ran into some difficulties. The main problem is that the wrapped copy of Chrome, although it is independent, has its own icon, and works correctly on its own, cannot open URLs sent from other applications, so it doesn't work with Choosy.

Here is what worked for me, to get a second Chrome which can open links via Choosy, for example:

  1. Copy Library/Application Support/Google/Chrome to Library/Application Support/Google/ChromePersonal in your home directory. This is optional; I wanted to transfer over my Chrome User profiles to the new instance. But if you're OK starting fresh you can skip this.
  2. Copy Google Chrome.app to another location. I used /Applications/Google Chrome Personal.app.
  3. Copy my wrapper.sh script (below) into the app's Contents/MacOS directory.
  4. chmod +x wrapper.sh
  5. Modify Contents/Info.plist in this new app to:
    • point to the wrapper script (set CFBundleExecutable value to wrapper.sh)
    • have a unique CFBundleIdentifier (just add "Personal" to the existing value)
    • have a unique CFBundleName (just add "Personal" to the existing value)
    • have a unique CFBundleDisplayName (just add "Personal" to the existing value)

Here is my modified wrapper.sh script. Put it at /Applications/Google\ Chrome\ Personal.app/Contents/MacOS/wrapper.sh and then edit the Info.plist as in step 4.

#!/bin/bash

# Wrapper script that starts independent instance of Google Chrome for Mac

# To use: copy Google Chrome.app to a new location.  Copy this script into
# the Contents/MacOS directory of the copied app.  Edit the copied app's
# Contents/Info.plist and change CFBundleExecutable to "wrapper.sh",
# and pick a unique CFBundleIdentifier.

# Instance data will be stored here.  You can copy your existing data 
# to this location if you want to preserve your existing user profile(s).
# You can also change this if you want to store the data somewhere else.
INSTANCE_DIR="/Users/$USER/Library/Application Support/Google/ChromePersonal"

# Find the Google Chrome binary:
CHOME_BIN="$(dirname "$0")/Google Chrome"

# Start Chrome
exec "$CHOME_BIN" --user-data-dir="$INSTANCE_DIR"

One caveat: I believe Chrome's auto-update feature will break this every time Chrome updates, meaning you need to re-do steps 3 and 4 after every Chrome update.

share|improve this answer
    
Following these instructions I get an app that won't launch –  Tom J Nowell Feb 18 at 22:47
    
Sorry @TomJNowell! I guess I must have missed a step. Probably you have to chmod 755 the wrapper.sh script? Mine is executable. If you try that and it fixes the problem for you, let me know so I can update the answer? –  jbyler Feb 19 at 6:20
    
chmod +x did the trick –  Tom J Nowell Feb 19 at 11:51
1  
Thanks! Added to the instructions. –  jbyler Feb 20 at 6:55

Have you tried the beta build? I can't test right now, so I'm not 100% sure it's a different icon - and if not, you can also try the "canary build" -

It shouldn't be so far off the official build in term of rendering so you can trust what you see. And you can make your developer profile the default one.

share|improve this answer
    
I'm not clear on what you're suggesting. Are you suggesting running two different versions of Chrome at the same time? (stable and beta). I'd really rather use stable across the board. Thanks for the suggestion, though. –  Andrew Ferrier Oct 8 '12 at 14:17
    
FWIW, I downloaded Chrome from the Beta channel and it has the same icon, so unfortunately that doesn't help me much there either... –  Andrew Ferrier Oct 8 '12 at 14:18
    
FYI, Chrome Canary actually has a different icon, but its less stable (it general works though). –  studgeek May 30 '13 at 16:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.