This is a replacement for PR #131: tweaks and improvements to OSX setup script