UPDATE: Google Chrome Beta (starting from v16) now supports multiple profiles. It allows almost the same thing that this article describes below. See the announcement about it in the Google Chrome blog.
If you have multiple accounts in different sites (GMail, Picasaweb, etc) and ever wondered how you can be logged in into both in your favourite Google Chrome browser, then I have a nice solution for you.
Of course you can use the Incognito mode to enter the credentials of a second account, but it is not preserved accross sessions. After a while providing the credentials over and over becomes boring.
I've read a little on how to run multiple Google Chrome instances on a Mac and found this wiki. I used it for myself and shared the link. While this is a good starting point, my friends started to complain that things did not work as they expected, so I decided to write my own tutorial on how to run multiple Google Chrome instances on one Mac:
Step 0: Install Google Chrome
I guess you already have Google Chrome installed. If not, install it from here. From now I will assume that it is in your /Applications folder.
Step 1: Create a shell script to launch a custom Chrome instance
Copy the following text into a file and name it as /usr/local/bin/custom_chrome.sh (or download it from here):
#!/bin/sh
if [ -z "$1" ]; then
echo "Usage: $0 profile_name"
exit 1
fi
PROFILE_NAME="$1"
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 this file executable: in Terminal, run: sudo chmod +x /usr/local/bin/custom_chrome.sh
Step 2: Create your own Google Chrome application
Let's create a new profile "corp" and name your new application "Google Chrome (corp)".
For this, you have to open the terminal and do the following steps:
$ sudo bash
Password: your_password
# cd /Applications
# APPNAME="Google Chrome (corp)"
# mkdir -p "$APPNAME.app/Contents/MacOS"
# cd "$_"
# echo -e '#!/bin/sh\nexec /usr/local/bin/custom_chrome.sh corp' > "$APPNAME"
# chmod +x "$APPNAME"
# cd /Applications
# chown -R your_username "$APPNAME.app"
# exit
Now you have another Chrome instance with a profile which is independent of the main application profile!
Step 3: Make a custom icon for this application
The default icon of a new application is not really nice, so you can either copy the icon from Chrome, or download a custom one.
Google Image Search for "chrome icon" gives you a bunch of beautiful icons. In this article, I used the Chromium logo, the image from this techreviews page, a neon-style icon and an icon from this forum post.
To install a custom icon, the first, you have to select the application in Finder, then click on "Get Info":
Now open your selcted icon with your browser, and drag the image into the Icon in the "Get Info" page:
Note, that Google Chrome sometimes changes its icon back to the original icon when it is running and as far as I know the only way to change it back is to restart the browser.
Step 4: Enjoy the result of your work
Now you can drag your new Google Chrome (corp) application to your Dock and watch it running parallelly with the original application.



I can't get this to work. When I try yo launch my new profile, it just disappears.
ReplyDeleteI had renamed my original Google Chrome.app. That was the problem
ReplyDeleteCool, I'm happy to have it solved.
ReplyDeleteNice post, I had found that other article as well but I like the finishing touches you added. I'm running 3 different versions of Chrome: beta, dev and release. I ended up going with this icon for release: http://treelz.deviantart.com/art/Worn-Chrome-icon-102191222
ReplyDeleteHi Robert! Thanks for the info. The icon looks nice!
ReplyDelete/usr/local/bin/ doesn't exist on my machine... did you have to create it? Is there a reason not to just put it in /usr/bin/?
ReplyDeleteHi Prefusion,
ReplyDeleteFeel free to use /usr/bin instead of /usr/local/bin. The idea behind /usr/local is that you usually put stuff there which are installed separately and not by the system, so that you can backup and restore everything by just copying that directory and reinstalling everything else.
Balázs
Hey - looks like a neat solution - one Q - does this completely separate cookies, usernames etc?
ReplyDeleteHi Huddo,
ReplyDeleteYes, they are entirely separate. This is the main point.
Balázs
when i try and save the script it gives
ReplyDeletesyntax error
Expected “,” or “]” but found “"”.
Strange error. I edited the blog entry to contain a link to the script: http://patches-dlux.googlecode.com/files/custom_chrome.sh . Can you pleast try to download that?
ReplyDeleteI'm lost... do I need to change text in the custom_chrome.sh? For some reason the new link doesn't work.
ReplyDelete@Erik: no, you don't. The new link (in the blog entry itself) should pop up a download window. But if you copy-paste the URL from the comment, it should work as well. What is it doing for you?
ReplyDeleteWorks a treat. Just a pity spaces does not recocgnize the Google (corp). Any way to do that? Now it opens in the same space as the normal chrome does.
ReplyDelete@Daniel: Sorry, I don't know how to make Spaces think this is a separate application... :(
ReplyDeleteThis is a fantastic tutorial. Worked like a charm!
ReplyDeleteHave you ever figured out a way to get the icon to stop changing back to the default? This is the ONLY drawback to this amazing tutorial (and totally not your fault).
This is a great hack. One problem that I ran into is that extensions that are installed on the client side by local software (e.g. 1Password) only go to the original user. The best workaround I found was to have the secondary Chrome user open the extension within the primary user account. To do this, select Window>Extensions in the Chrome menu and select the plus sign by developer mode. Click "upload unpacked extension" and Navigate to User/Library/Google/Chrome/Default/Extensions. Chrome assigns a random character string to each extension, but if you select the right extension within that directory it will be available to the secondary user account. I don't know whether this will update properly like other extensions, but it seems to be working.
ReplyDeleteHi Ryan,
ReplyDeleteUsually you can download any extension and install them through the Chrome Extension database to every different instance.
1Password is an exception, because they did not provide an URL to the extension and the 1Password software supports installing to the first instance only. After an email exchange with their support, I got the URL. So installing the 1Password extension can be done by navigating to http://aws.cachefly.net/aws/dmg/1PW3/English/OnePasswordChrome.crx . The advantage of this is that it auto-updates itself, unlike the manual install method.
I suspect this can be done with a single .app - perhaps even posted as a single item to download. I'll experiment with it in a bit.
ReplyDeleteThat's really useful! Thanks!
ReplyDeleteHello. Just tried this on OSX Lion, but doesn't seem to work. Getting an error Exited with code: 126 as reported by com.apple.launchd.peruser.501
ReplyDeleteSorry, I don't have Lion, so I cannot test it.
ReplyDeleteThe second script doesn't require superuser.
ReplyDeleteMy suggestions:
http://pastebin.com/cKqYN26K
Indeed, it does not require a superuser acc.
ReplyDeleteBtw, I propose using the new profiles feature of Google Chrome Beta, that is much easier to use: http://chrome.blogspot.com/2011/11/take-your-chrome-stuff-with-you-in-new.html
im having a hard time getting the file to /usr/local/bin anytime i try using terminal to move a file there it says permission denied. Im new to this coding stuff, can you please help me
ReplyDelete@karan: You can try the new profiles function of Beta version of Google Chrome as linked in the comment just above yours.
ReplyDeleteFor your problem: you have to be root to write to /usr/local/bin. If you don't know how to get root, you can use another directory in your home.