Skip to content

Instantly share code, notes, and snippets.

@archfear
Created November 8, 2013 04:13
Show Gist options
  • Save archfear/7366180 to your computer and use it in GitHub Desktop.
Save archfear/7366180 to your computer and use it in GitHub Desktop.
This script creates an app which launches Google Chrome with a new profile and allows for running multiple instances of Chrome simultaneously.
#!/bin/bash
#
# This script creates an app which launches Google Chrome with a new profile
# and allows for running multiple instances of Chrome simultaneously.
#
# Based on: http://blog.duoconsulting.com/2011/03/13/multiple-profiles-in-google-chrome-for-os-x/
set -e
if [ $# == 0 ]; then
echo "usage: chrome-profile profile_name"
exit 1
fi
PROFILE_NAME=$1
mkdir -p "/Applications/Google Chrome $PROFILE_NAME.app/Contents/MacOS"
F="/Applications/Google Chrome $PROFILE_NAME.app/Contents/MacOS/Google Chrome $PROFILE_NAME"
cat > "$F" <<\EOF
#!/bin/bash
#
# Google Chrome for Mac with additional profile.
#
# Name your profile:
EOF
echo "PROFILE_NAME='$PROFILE_NAME'" >> "$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="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
if [[ ! -e "$CHOME_BIN" ]]; then
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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment