Sometimes, Firefox bounces in the Dock and will not open. Either a new Firefox version has been pushed out to the machine, or some Firefox settings have changed. If it's on a personal machine, it's pretty easy to handle. What if it happens on a corporate network with many users, and you must repair them all?
Here is a solution so that a user clicks on the Scripts menu in the menu bar and selects a script from a drop down menu called Reset Firefox.
A pop-up dialog box asks the user 'Do you wish to reset Firefox,' with Yes and No buttons. The user clicks Yes and another dialog pops up 'Just leave the script to do its stuff. Firefox will open with instructions on how to restore your Bookmarks.' with an OK button.
The user clicks OK and waits, and after a short period, Firefox opens as a new user would see it asking the normal setup questions like do you wish to import anything, set the default browser, etc. Then a web page automatically opens which is a Mozilla KB article telling them how to reset their bookmarks.
How to set it up:
#!/bin/bash # Quitting Firefox killall firefox-bin # Removing previous Firefox_bookmarkbackups rm -rf ~/Documents/Firefox_bookmarkbackups # Pausing 3 seconds sleep 3 # Making a backup directory mkdir ~/Documents/Firefox_bookmarkbackups # Making a temp direcory mkdir ~/Temp # Pausing 3 seconds sleep 3 # Find the users bookmarkbackups and move them to the temp directory Find -x ~/Library/Application Support/Firefox/Profiles/********.default/ -name 'bookmarkbackups' -print0 | xargs -0 -I bookmarkbackups cp -R bookmarkbackups ~/Temp/ # Pausing 3 seconds sleep 3 # Copy the bookmarkbackups to the Firefox_bookmarkbackups directory cp -R ~/Temp/bookmarkbackups ~/Documents/Firefox_bookmarkbackups/ # Pausing 5 seconds sleep 5 # Deleting the FireFox app data rm -rf ~/Library/Application Support/Firefox # Removing the users Firefox cache rm -rf ~/Library/Caches/Firefox # Pausing 5 seconds sleep 5 # Launch Firefox open /Applications/Firefox.app # Pausing 10 seconds sleep 10 # Moving the bookmarkbackups from the temp to the users new app data location Find -x ~/Library/Application Support/Firefox/Profiles/ -name '********.default' -print0 | xargs -0 -I folder mv ~/Temp/bookmarkbackups/ folder # Pausing 3 seconds sleep 3 # Removing the temp directory rm -rf ~/Temp # Opening the web page for instructions to recover bookmarks open http://kb.mozillazine.org/Backing_up_and_restoring_bookmarks_-_Firefox#Restoring_bookmarks_from_backup /Applications/Firefox.app
display dialog "Do you wish to reset Firefox? You will be able to recover bookmarks following instructions from the opening page." buttons {"No", "Yes"} default button "Yes"
if button returned of result is "Yes" then
display dialog "Please wait for the script to do its stuff and Firefox should open automatically."
if button returned of result is "OK" then
do shell script "/Library/Management/Scripts/Reset_Firefox.sh"
end if
end if
Mac OS X Hints
http://hints.macworld.com/article.php?story=20110304042542294