Sat 18 Sep 2004

Stopping Safari from quitting: instructions for a better life

Either navigate into the Safari package, find English.lproj, and open the MainMenu.nib file inside, or type

open /Applications/Safari.app\
/Contents/Resources/English.lproj\
/MainMenu.nib

in the Terminal. This will open Interface Builder for you. You can copy-paste that whole lot, with backslashes, or type it all on one line, without backslashes.

Interface Builder will tell you that it has fixed errors for you. If you're scared, make sure you back up MainMenu.nib before you save.

In a window titled “MainMenu.nib” there is an icon named MainMenu. Double click on it, and a floating menu appears. Click on “Safari”, then “Quit Safari”. In the window titled “NSMenuItem Info”, delete the contents of the “Key Equivalent” field, and uncheck the Command symbol.

These two actions (editing the menu item, and opening the file) have two effects. Firstly, you've disabled the shortcut key for quitting Safari; you have to use the menus. Secondly, you've enabled the Debug menu, which allows you to import/export bookmarks, use an HTML snippet editor, check caches and shortcut keys, and open the current page in any other browser, among other things. Very cool.

Save the altered file (Cmd-S, or quit and agree), and relaunch Safari. Try pressing Cmd-Q, and giggle happily when nothing happens except a beep.

Now I'm happy.

Bear in mind, however, that you will need to do this again next time Safari is updated. A small price to pay, I think.

Posted at 2004-09-18 17:37:13 by RichardLink to Stopping Safari fr…