Tuesday, August 31, 2010

Run Multiple Google Chromes with different profiles on a Mac

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.

Sunday, August 15, 2010

Parallel::ForkManager 0.7.6 (#perl, #forkmanager) and publicity

I've put out a new Parallel::ForkManager release: 0.7.6 with small changes:
  • Added datastructure retrieval from child processes. (Ken Clarke)
  • Using CORE::exit() instead of exit() for mod_perl compatibility.
The new version is available in the project page and (sooner or later) from CPAN.

I did some research about the module publicity and found the following things:
Enjoy!