OS X Tip: Opening header files from the command line

By Erica Sadun
April 15, 2009

Mac guru Kevin Ballard recently reminded me of this great little command line tip. The -h flag for open will search all the standard include file locations for headers that match the string you pass. It then offers you a list of options as to which header file to open, as you can see in the screen shot below.

osxopenheadersutil.jpg

Choose 0 to leave without opening any file, 1 to open all the files listed, or select any number to pick which header you want to display. The files will open directly in Xcode, where you can see the contents with Xcode's syntactically-aware formatting.

This open -h shortcut is just one of many little OS X command line gems that regularly gets overlooked, and shouldn't be. It's a great way to find the header files you need to use with very little work.


You might also be interested in:

News Topics

Recommended for You

Got a Question?