Fixed OSX specific initialization in headless mode.