Related question on Unix/Linux: How should I install software from source so that I can make my configuration manageable and reproducible? However, I've tailored this question more towards the Mac OS X ecosystem.
I work with a lot of scientific software on Mac OS X (currently 10.7, but also 10.6). In order to maximize performance and get access to the latest features, it's often preferable to compile software from source.
However, doing so is messy, and can lead to configuration problems. Since I also develop in Linux, I looked at all of the suggestions in the Unix & Linux question "How to compile and install programs from source" and the Unix & Linux question Where should I put software I compile from source? for some guidance. These questions are a good place to start, but it's not clear to me how I can manage dependencies and the configuration easily. For example, if I build the development branch of NumPy from source, how should I detect, manage, and resolve dependencies so that I can manage my configuration? A package manager like MacPorts, Homebrew, or Fink is one option, but if I go that route to manage my configuration, how do I compile packages so that I can use those package managers to manage dependencies? Is there something like something like checkinstall for these package managers? My goal here is to make installing and uninstalling software relatively painless without cluttering my configuration.
I'd also like to make my configuration reproducible. By that, I mean I'd like to set up a workflow for installing software on my machine so that I could repeat it exactly on a fresh OS install. Is there a best practice for that? When it comes to standard packages in a Linux package manager, the simplest method for repeating a software install is to make a script containing the appropriate
apt-get install <package> (or equivalents). However, when installing software from source, I could see this method getting very complicated. Is there a better way?
Furthermore, for Mac OS X, many applications are installed by copying a
*.app file to
/Applications, or by double-clicking on a
*.pkg file. Can I install these from a command line and script the installation of these packages? Furthermore, is there a good way to uninstall these packages?