Scratch that. getopt doesn't work on mac os - http://stackoverflow.com/questions/11777695/why-the-getopt-doesnt-work-well-in-my-mac-os.