Last Updated: February 25, 2016
· mnem

Quickly opening header files from OS X terminal.

The open command on OS X is endlessly useful for jumping from a terminal into apps, but did you know that you can also quickly find and open system header files? It's pretty simple:

# Short form
open -h stdlib.h

# Long form
open --header stdlib.h

You can specify multiple header files to open. If any header names are ambiguous it'll be nice and ask which one you wish to open or if you want to open all of them. The files are opened with the default app to handle header files, however you can combine it with the other switches to open them in something else:

# Open the headers in Sublime Text
open -a "Sublime Text" -h stdlib.h

# Open the headers in Sublime Text and wait for
# Sublime to exit before continuing
open -Wa "Sublime Text" -h stdlib.h