Have you ever experienced some sort of phenomenon that corrupts or otherwise inhibits you ability to safely open an application on your Mac? Recently a friend of my announced on twitter that she had clicked a link that ‘messed up’ her Safari and that she thought it was infected with a virus or trojan. I thought since the answer while obvious to me was not openly available on the net I would publish it here for future reference.
Unfortunately my Google search did not yield anything of consequence so I did some digging on the command line and found the following command through trial and error. Actually to be quite honest I nailed it on the first try but let’s just chock that up to blind luck. Honestly I just made a guess that the property name would be HomePage written in camel text.
defaults write com.apple.Safari HomePage https://www.jafdip.net
After executing the command I was able to confirm that this was correct by simply opening Safari on my machine and observing the result. Another option would be to use the Properties List Editor to open ~/Library/Preferences/com.apple.Safari.plist but if your system is not set up for development work then it is not likely you will have such a tool at your disposal. The following is a snapshot of what it would look like.
Unfortunately the file is a binary plist (property list) and should not be edited directly without the proper tool. If you do then you could render Safari completely inoperable under your ID on the Mac. Your options at this point would be to try deleting the file and let Safari creates a new default version or to grab a copy off of some one elses’ Mac ID but in either case you will likely loose any preferences you had.
In fact if resetting the homepage does not work then you will likely need to resort to deleting the plist and hope that a fresh start of Safari will result in the best. Open the terminal app which is located in Applications/Utilities. The following is a snap of what your terminal window might look like.
Enter the following command and you will be prompted for your password if you have one. I will not argue the necessity of having a strong password on your Mac rather I’ll just say that you are asking for trouble if you do not.
rm ~/Library/Preferences/com.apple.Safari.plist
Since Mac OS X is based on an open source UNIX (FreeBSD) it will return to an empty command prompt if the command is successful. Simply launch Safari as you normally would and enjoy the startup music as well as resetting all of your preferences… again.
Related articles
- Advanced Mac OS X Shell Scripting (jafdip.com)
- Performing MacPorts Magick (jafdip.com)
- I can’t add bookmarks on Safari 5.1: Apple Support Communities (chimac.net)
- Three Useful Safari Startup Tricks That You Might Not Be Familiar With (makeuseof.com)
Leave a Reply