In apple case, use lchmod and not chmod. (zapped some trailing whitespace too).
Got rid of some generated(?) files and added .gitignore.