Mac – Checking for MacPorts or Fink installed

bashfinkmacports

I'm writing an install script for some software that depends on libUSB being installed however I need to check if macports or fink is installed, if they are not install homebrew. How can I check to see if the macports or fink are installed in a shell script?

Best Answer

Macports will have /opt/local/lib/port as the executable that does all the work.

Fink's main executable is fink - I think it is in /sw/bin/fink but as I don't have fink installed I cannot confirm

You also need to see if there is anything in /usr/local that could conflict with home-brew.

A better alternative, as you are using a package manager, is write your installs a script in all of the package managers, rather than introduce yet another installer

The usual OSX way is to create an app with all the required shared libraries inside the app bundle so there is no need for a special install just copy the app.