Different Environments for different command line app's

Valued Contributor

I keep bumping up against the issue of different things like Macports, HomeBrew, gfortran and precompiled command line executables need their own specific environment in the shell. 

I've been lucky most of the time that there's been enough overlap of the apps and I could negotiate to not have MacPorts or HomeBrew but I finally hit one that is just causing pain as I really need everything.  When I've seen big linux systems, they usually have something that you can run to configure your environment usually when you open the shell.

I was thinking I'd try something along the lines of a script that runs when you open Terminal and it displays choices for MacPorts, HomeBrew etc and runs the environment setup for them that way rather than my existing all you can eat way from the system wide files in /etc.  I did talk with one of our big system managers who said they use something called Environment Modules (https://modules.readthedocs.io/en/latest/index.html)

Just wondering what other people use in this situation?


Honored Contributor

My solution has been to not allow 3rd party Package Managers. The Business Unit that wants to use a tool that requires HomeBrew for example needs to find another solution to meet their needs. Where it is possible to package tools from HomeBrew, it is far more time than its worth. In my environment where we require the ability to manage the apps that get installed, a Package Manager is not an option.