Safari’s Debug Menu

For web developers on Mac OS X, there is a wonderful and powerful hidden tool in Safari that in part functions like the Firefox extension Web Developer. Though it does not have quite the same depth as Chris Pederick’s tool.

The Safari Debug menu can be activated with a simple command in OS X’s Terminal (/Applications/Utilities/Terminal.app). At the initial shell prompt typing ‘defaults write com.apple.Safari IncludeDebugMenu 1′ (with Safari closed) will add one additional menu item upon its next launch. By changing the 1 to a 0 the Debug menu can be turned back off.

The extra menu has several nice tools, most straightforward but still largely undocumented. These include a page load tester similar to what ab can do for performance testing Apache (could possibly be leveraging it), access to viewing a document’s architecture (tree views), User-Agent masquerading and JavaScript debugging.

There are more handy tidbits – for instance opening the same page in multiple other browsers installed on your Mac for preview tests via a single click within Safari, and some limited SSL debugging.

Finally – a nice little bookmark importer for Mozilla, IE and Netscape (sorely missing in Safari without the Debug menu on!) and the capability to export Safari bookmarks rounds it out on the convenience scale.

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

  • http://www.36-degrees.co.uk cloak

    wow, this is excellent. Ive been dying to find an easy way to get my bookmarks imported into safari. Thanks very much.

  • http://www.sitepoint.com/ mmj

    I’m amazed that something so useful would be hidden.

  • nate

    another useful feature in the debug menu is the ability to “fake” using another browser – for example, Safari can tell a website that it is IE6 on windows. I’ve found that many of the websites that don’t work with a non-IE browser miraculously begin working just because they THINK you’re using Internet Explorer…

  • WebMediaChic

    Anyone know of a reason why the reporting from the Page Load Test Window (in the Debug menu) would not agree with the Activity Window?

    Page Load Test Window shows over 5MB, while the sum of the files in the activity window is much much much smaller.

    We do run ads from multiple ad servers (different domains). Anyone know if the activity window would miss some of this?

    Thanks!