Skip to content

Instantly share code, notes, and snippets.

@mroch
Created March 22, 2011 23:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mroch/882359 to your computer and use it in GitHub Desktop.
Save mroch/882359 to your computer and use it in GitHub Desktop.
Makes Firefox.app open a version-specific profile so you can run multiple versions at the same time
#!/bin/bash
FIREFOX_APP=${1:-/Applications/Firefox.app}
[[ ! -d "$FIREFOX_APP" ]] && { echo "Could not find Firefox"; exit 1; }
FIREFOX_BIN="$FIREFOX_APP/Contents/MacOS/firefox-bin"
[[ ! -f "$FIREFOX_BIN" ]] && { echo "Can't find executable"; exit 1; }
FIREFOX_VERSION=`defaults read "$FIREFOX_APP/Contents/Info" CFBundleVersion | cut -d . -f 1,2`
FIREFOX_PROFILE="Firefox$FIREFOX_VERSION"
"$FIREFOX_BIN" -CreateProfile "$FIREFOX_PROFILE"
FIREFOX_LAUNCHER="$FIREFOX_APP/Contents/MacOS/multi-firefox-bin"
cat > "$FIREFOX_LAUNCHER" <<EOF
#!/bin/bash
"$FIREFOX_BIN" -P "$FIREFOX_PROFILE" -no-remote
EOF
chmod +x "$FIREFOX_LAUNCHER"
defaults write "$FIREFOX_APP/Contents/Info" \
CFBundleExecutable -string multi-firefox-bin
defaults write "$FIREFOX_APP/Contents/Info" \
CFBundleIdentifier -string "org.mozilla.firefox.$FIREFOX_VERSION"
# Apparently necessary to re-cache Info.plist
touch "$FIREFOX_APP"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment