Safari javascript debugging

Execute this command in a Terminal window and then re-launch Safari to get a Debug menu with useful things like, oh, a JavaScript console:

defaults write com.apple.Safari IncludeDebugMenu 1

There's also WebKit with Drosera, which I'm not as familiar with - just having the console has been enough for me to troubleshoot most Safari-specific problems. With WebKit there's an equivalent to the "Inspect Element" that Firebug provides when you right-click on something. With old WebKits you may need a similar defaults write trick:

defaults write com.apple.Safari WebKitDeveloperExtras -bool true

I'm a big fan of the HTML Validator Firefox plugin; I spent a few days cleaning up markup on my sites when I first installed it. Safari Tidy provides something very similar.

Finally for now, http://pimpmysafari.com/ is a general resource for Safari plugins, bookmarklets, etc.