Update install scripts and brew/macports

* Fixed bug with checking for existing files
* Improved homebrew and macports detection