Modify to work on Mac OS X and Centos/RedHat