script/osx: import few changes from @mathiasbynens