Bunch of fixes and make it build for Mac OS X

I still had to disable xfce4-session for osx though.