Devoured By Lions

the eternal struggle to tame complexity

The Curiously Recurring Installation Pattern*

Once again I find myself installing a piece of *nix software, only to struggle against its blind insistence on being installed in the bowels of my system. It goes something like this:

* ./configure # let it use the default path because we will rewrite the dest dir on install and stow it (ha ha.)
* make
* make install DESTDIR=”/my/software”

Depending on the software build system, this may or may not work. (see: http://www.ruby-forum.com/topic/818302). If it doesn’t, well, it’s your lucky day. You do have all the output in your terminal scrollback right? Good, ‘cause you’ll need to go and manually remove every last file it installed and try again.

If DESTDIR worked, you may be able to stow now:

* sudo stow -t /usr/local -d /my/software awesome-app

Except of course if the build system installed in this brilliant fashion: /my/software/usr/local/… Oops! Time to clean up again! (if you are brave/foolish you can certainly try ‘stow -t / -d /my/software awesome-app’ instead. Good luck with that.)

* cd /my/software/awesome-app
* mv usr/local/* .
* rm -r usr/local
* cd ..
* sudo stow -t /usr/local -d /my/software awesome-app

Since this is such a colossal PITA, in some cases wrappers have been developed that essentially put a big condom around builds and allow you to manage them like a sane, normal user, in your own directory. Some examples are RVM, the Ruby Version Manager, NVM, the Node Version Manager (takes care of NPM as well), and PythonBrew (an RVM equivalent for Python). While these are absolute life-savers, they are really covering up an underlying flaw which is that a lot of *nix software is built to install only into the global system (which frankly is mystifying given *nix’s heritage of strong user/system separation. maybe it’s just a legacy of the traditional *nix tool chain).

(* http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern)