Recovering the Safari address field

Tags: 

Apple's Safari is my browser of choice on OSX - it's fast, it has a great RSS reader, and it's generally very stable. Occasionally I run into glitches with it, though.

A perfect example is what happened to me tonight. The machine had been running a bit slow having been unused all day, and when I tried to start interact with apps it was taking them a few moments to get caught up. I should note that I also am having problems with my MacBook's armrest that has started clicking the mouse button if I press on the wrong area. Anyway, while the apps were warming up I accidentally dragged the address field / address bar out of the toolbar then watched in horror as it went poof and disappeared.

201002181927.jpg  

Not to much of a problem, I thought, and I went to change the toolbar settings to restore it, only the Customize Toolbar window wouldn't open. Further, the "Open Location" menu item was disabled.

201002181927.jpg

ARGH!

I tried searching online on ways to recover it but all of the suggestions boiled down to "reset it through the Customize Toolbar window", which obviously wasn't going to work.

Thankfully I was aware that Apple uses XML-like property-list, or "plist", files to store settings for most of its applications. I also knew that there were preferences files in the "Preferences" directory of the "Library" in my home directory, one for most of the applications I had installed, including one named "com.apple.Safari.plist".

Opening this file brings it up in OSX's Property List Editor tool which provides a tree-like interface into the various properties that have been assigned. Just what was needed.

201002181929.jpg

Unfortunately the Property List Editor tool doesn't include a search so you have to just trawl through all of the settings until you find what you want, or something related, or something that might just look like fun. The problem I was having was related to the Toolbar and there was a large number of items that could be added to the toolbar, so I started looking for something with the word "Toolbar" in the name that contained sub-items, i.e. an array.

After a bit of searching I found the "dictionary" object "NSToolbar Configuration SafariToolbarIdentifier" which had the sub-property "TB Item Identifiers".

201002181934.jpg

Guess what this contained - yep, you guessed it, an array of strings named "BackForwardToolbarIdentifier", "StopOrReloadToolbarIdentifier", "HomeToolbarIdentifier", "PrintToolbarIdentifier", "AddBookmarkToolbarIdentifier", "OPToolbar1Passwd", "WebSnapper" and, lastly, "InputFieldsToolbarIdentifier". My Safari toolbar only had five items, not the eight in this list, but at least it had relevant-sounding names.

201002181937.jpg

A moment later I noticed that right beside this dictionary was another one named "NSToolbar Configuration BrowserWindowToolbarIdentifier", which also had an array named "TB Item Identifiers". This list was shorter.. only five items, and each of them seemed to be the items that were showing in my toolbar.. Was this what I was looking for?

201002181938.jpg

Before I dug further I closed Safari so it wouldn't try to overwrite the file I was trying to manually modify. I then went to the "TB Item Identifiers" array and clicked the "Add Item" button, which added an "Item 6" entry to the array; making a guess I copied the "InputFieldsToolbarIdentifier" item from the other array and pasted it in as the value for the new "Item 6".

201002181939.jpg

I then saved the file and opened Safari...

201002181925.jpg

Yay! :-D Problem resolved, back to life as normal.

How to reply

Care to add your own 2 cents? Let me know via Twitter or my contact page.