Fix issue with headless mode on Mac OS X