4

I'm running this shell script as an app in OSX to initiate multiple instances of Chrome with a fresh personal folder:

do shell script "/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --enable-udd-profiles --user-data-dir=/Users/$USER/Library/Application\\ Support/Google/ChromePersonal > /dev/null 2>&1 &"

This is awesome - because I can CMD-TAB between instances of Chrome without purging cookies/cache etc.

The problem: I'd like to expand the script to overlay a big "2", "3", etc over the Chrome icon for each instance in the Dock and CMD-TAB popup so that I can differentiate between isntances. Right now, all I see are multiple Chrome.app icons.

Any ideas on how to accomplish this? I'm also open to editing the icon, however the Chrome2.app icon does not influence the Dock icon - because the dock icon comes from the original Chrome.app.

UPDATED: Problem Solved, Here's How:

  1. Copy-Paste "Google Chrome.app" to create a carbon copy in the Applications folder.

  2. Name the copy something like Chrome2.app.

  3. Follow the instructions from Google to create the Applescript, based on the NEW copy of Google Chrome.app that is now named Chrome2.app. Could name this script something like LaunchChrome2.app, etc. This will launch the NEW copy of Chrome with the correct (alternate) user profile, therefore no cookie issues will happen.

  4. Change the name of Chrome2.app and the icon of Chrome2.app to whatever you want to show up in the Task Switcher and Task Bar. The base application, NOT the script shortcut, is what determines the icon and name in OS X.

  5. Ta-da.

  6. Optional: Set up Google Sync between the two copies of Chrome so that your bookmarks, prefs, extensions, stay the same!

Jed B
  • 43
  • 1
  • 5

4 Answers4

3

I'm using the script at http://blog.duoconsulting.com/2011/03/13/multiple-profiles-in-google-chrome-for-os-x/, which creates new Chrome application for you in the Applications folder, tied to a specific profile.

After that you can simply Get Info and paste a PNG as your icon. I use differently colored Chrome icons and themes for each Chrome instance.

Miguel
  • 1,156
  • 1
  • 7
  • 5
  • I modified the script a bit to be able to use a profile for each version of Chrome (stable, beta, dev), and zipped the generated apps so it's easier to install. Instructions and modified script source here: http://tech.finn.no/2011/04/07/multiple-versions-of-chrome-on-os-x/ – gregers Apr 07 '11 at 19:44
  • The above duo consulting blog url appears to have changed to http://thoughts.duoconsulting.com/blog/multiple-profiles-google-chrome-os-x – Keegan 82 May 27 '15 at 16:34
1

The best way to achieve this (courtesy of this Chromium help doc) is:

Writing an AppleScript wrapper (Mac OS X)

On Mac OS X, you can create an application that runs Chrome with a custom --user-data-dir:

  1. Open Applications > Utilities > Script Editor.

  2. Enter:

set chrome to "\"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\""
set userdatadir to "\"$HOME/Library/Application Support/Google/Chrome Alt\""
do shell script chrome & " --user-data-dir=" & userdatadir & " > /dev/null 2>&1 &"
  1. Modify as needed for your installation path, Chrome versus Chromium, and desired user data directory.

  2. Save the script in your Applications directory with the file format "Application".

  3. Close the Script Editor, find your newly created application, and run it. This opens a Chrome instance pointing to your new profile.

If you want, you can give this application the same icon as Chrome:

  1. Select the Google Chrome application and choose File > Get Info.
  2. Select the icon at the top left of the info dialog. You will see a blue highlight around the icon.
  3. Press ⌘C to copy the icon.
  4. Open the info dialog for the new application and select the icon in the top left.
  5. Press ⌘V to paste the copied icon.
Mason Freed
  • 5,493
  • 1
  • 19
  • 13
0

The "instructions from Google" mentioned in the question no longer talk about how to create an AppleScript, so I wasn't able to get that one to work.

I also tried a variant of the script from @Miguel 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. Modify Contents/Info.plist in this new app to point to the wrapper script (set CFBundleExecutable value to wrapper.sh), and to have a unique CFBundleIdentifier (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"

(full disclosure: I also posted this answer on apple.stackexchange)

Community
  • 1
  • 1
jbyler
  • 7,200
  • 3
  • 34
  • 42
0

This is duly answered including the icon in the Google Chrome help here. I use it and it works well. The only problem I have is that the "profile 2" dock icon doesn't keep highlighted and a new -third- dock icon appears.

Scott Willeke
  • 8,884
  • 1
  • 40
  • 52
  • The behavior is completely different for me. I created Chrome2.app, pasted a different icon into the 'get info' box in OS X, however the application icon in the task bar and task switcher (CMD-Tab) is the exact same as the normal chrome application. This is logical because Chrome2.app is a script to launch another copy of the same app. So how do you get this to display a different icon in the task bar and task switcher? – Jed B Jul 16 '11 at 21:03
  • If you notice in my answer above I wrote "The only problem I have is that the "profile 2" dock icon doesn't keep highlighted and a new -third- dock icon appears." - Essentially the dock icon to start the second profile works fine and has the new icon, but once it starts up, it uses a plain dock icon with the original chrome icon. I was thinking of copying the entire chrome.app bundle and renaming it but I haven't had a chance to play with that yet... – Scott Willeke Jul 19 '11 at 15:44