Fix OS X build

Some fixes for the build on OS X and also adding .DS_Store files to .gitignore.