Pages

Subscribe:

Ads 468x60px

Labels

Saturday, November 19, 2011

How to run Chrome with different profiles?

I have quite a number of Google accounts for different projects. In windows, I use to setup different chrome profiles so i don't need to login and logout different accounts. The way to achieve that is easy, just specify a commandline switch to start the app and all works perfectly. How to do that in Mac?

Running application in Mac is different from Windows, clicking the app icon on the dock will launch the application. It is a total unfamiliar situation for a new switcher from Windows. Right clicking it has nowhere to specify the commandline parameters. I know unix, but how to start that app in a shell? Indeed, it is not easy and there is a solution after quite a search on the internet.

Here is the solution:

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 "new" and name your new application "Google Chrome (new)".

For this, you have to open the terminal and do the following steps:

$ sudo bash
Password: your_password
# cd /Applications
# APPNAME="Google Chrome (new)"
# 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

The solution is found from http://blog.dlux.hu/2010/08/run-multiple-google-chromes-with.html

There is, however, a problem that the new profiled chrome cannot be found in the LauncherPad. Any help?

0 comments:

Post a Comment