Update osx-setup.sh script with changes from @mathiasbynens

Merged changes up to commit 6e9822e879caed207f743c9eeadbf724610bff02

See https://github.com/mathiasbynens/dotfiles/commit/6e9822e879caed207f743c9eeadbf724610bff02#diff-8943ceaa36d5096fe7afe4138692c034