Fix annoying error in osx and change cmake for mac