Enabling the Safari debug menu

Safari has a very useful Debug menu for checking Javascript errors, viewing a page’s DOM tree, changing its User Agent string, and much more. Unfortunately, it’s disabled by default, so many users never even know about it.

To enable it, open a terminal window and type:
defaults write com.apple.Safari IncludeDebugMenu 1

I’m not sure why you’d want to, but to disable it again type:
defaults write com.apple.Safari IncludeDebugMenu 0