Fix and improve OSX configuration