Created
March 14, 2011 02:17
-
-
Save cowboy/868662 to your computer and use it in GitHub Desktop.
Multi-Firefox Fixer: Run multiple versions of Firefox simultaneously! (note: doesn't work on Windows)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$1" = "-h" -o "$1" = "--help" ]; then cat <<EOF | |
Multi-Firefox Fixer - v0.2 - 4/26/2011 | |
http://benalman.com/ | |
Usage: `basename "$0"` | |
Run this shell script from beside (in the same parent directory as) one or more | |
Firefox*.app or Aurora*.app applications and it will "fix" those Firefoxes to | |
always use an app-named profile. For example, if an application is named | |
"Firefox 2.0.app" then the "Firefox 2.0" profile will always be loaded when | |
that application is run. This allows multiple versions of Firefox to be running | |
simultaneously. | |
Note that upon first run of a "fixed" Firefox, an app-named profile will need | |
to be created. This can be done in the dialog that Firefox displays, just be | |
sure to name it correctly! | |
Copyright (c) 2011 "Cowboy" Ben Alman | |
Dual licensed under the MIT and GPL licenses. | |
http://benalman.com/about/license/ | |
EOF | |
exit; fi | |
ERR='ERROR: No Firefox*.app or Aurora*.app apps found in current directory!' | |
for ff in Firefox*.app Aurora*.app; do if [ -d "$ff" ]; then ERR=; fi; done | |
if [ "$ERR" ]; then echo "$ERR"; echo "For usage instructions, run: \ | |
`basename "$0"` -h"; exit 1; fi | |
for ff in Firefox*.app Aurora*.app; do | |
ROOT="$ff/Contents/MacOS" | |
BIN="$ROOT/firefox-bin" | |
echo $ff | |
if [ -z "`file "$BIN" | grep 'shell script'`" ]; then | |
echo " - Backing up firefox-bin executable to firefox.bin (first run only)." | |
mv "$BIN" "$ROOT/firefox.bin" | |
fi | |
if [ -f "$BIN" ]; then | |
echo " - Updating firefox-bin script." | |
else | |
echo " - Creating firefox-bin script." | |
fi | |
cat > "$BIN" <<'EOF' | |
#!/bin/bash | |
"`echo $0 | perl -pe 's/-bin$/.bin/'`" -P \ | |
"`echo $0 | perl -pe 's#.*/((?:Aurora|Firefox)[^/]*)\.app/.*#\1#'`" | |
EOF | |
chmod +x "$BIN" | |
done | |
echo 'All done!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cowboy at Cowbook in /Applications/Web Browsers | |
$ ls | |
Aurora.app Firefox 4.0.app Opera 9.64.app | |
Chromium.app Google Chrome.app Safari 3.2.1.app | |
Firefox 2.0.app Opera 10.10.app Safari 4.0.5.app | |
Firefox 3.0.app Opera 10.63.app WebKit.app | |
Firefox 3.5.app Opera 11.00.app chrome-console-text.sh | |
Firefox 3.6.app Opera 11.10.app multi-firefox-fixer.sh | |
cowboy at Cowbook in /Applications/Web Browsers | |
$ ./multi-firefox-fixer.sh | |
Firefox 2.0.app | |
- Backing up firefox-bin executable to firefox.bin (first run only). | |
- Creating firefox-bin script. | |
Firefox 3.0.app | |
- Backing up firefox-bin executable to firefox.bin (first run only). | |
- Creating firefox-bin script. | |
Firefox 3.5.app | |
- Backing up firefox-bin executable to firefox.bin (first run only). | |
- Creating firefox-bin script. | |
Firefox 3.6.app | |
- Backing up firefox-bin executable to firefox.bin (first run only). | |
- Creating firefox-bin script. | |
Firefox 4.0.app | |
- Backing up firefox-bin executable to firefox.bin (first run only). | |
- Creating firefox-bin script. | |
Aurora.app | |
- Backing up firefox-bin executable to firefox.bin (first run only). | |
- Creating firefox-bin script. | |
All done! |
FWIW, I have Firefox 2, 3, 3.5 and 4 running perfectly on OS X 10.6.7 thanks to this script. Sounds like a Leopard issue then?
I've switch to OSX 10.6.7 and confirm that works.
The problem is with OSX 10.5.8.
Great script by the way! Nice job
Does this work with Firefox 7 / OS X Lion? I ran the script, but when I opened Firefox 7 it didn’t ask me which profile to use.
I fixed it by running /Applications/Firefox\ 7.app/Contents/MacOS/firefox-bin -ProfileManager
afterwards.
FWIW, here’s a script that downloads different versions of Firefox, sets up a separate profile for each version, and even adds the version number to the app icon. http://gkoberger.net/n/firefoxes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It appears to work fine for me in OS X 10.6.7.