Updated semaphores to run on Mac OS X