-
-
Save mdeering/1198527 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 hidden or 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 hidden or 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! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment