Ixartz

GNU Stow, a package installation manager

February 23, 2014

Currently, I work on a compiler and I use GNU Bison to generate a parser. It is very painful to manage the different versions of Bison (I switch between several versions). Not long ago, I discovered a great tool named GNU Stow that simplifies managing different versions of a software package.

What is the usefulness to use Stow?

It is true that there are already package manager but Stow is very interesting to manage packages, which need to be installed by hand (for example, unofficial packages).

Installation

It is very easy to install Stow on Linux (and on Mac). Indeed, Stow is included in every major Linux repository. For example, on Ubuntu, you need to run this line:

sudo apt-get install stow

After that, you have to create a folder named stow at /usr/local/:

sudo mkdir /usr/local/stow

Stow in action

Installing a package with Stow

Stow requires that you change the default installation path by /usr/local/stow. With a make install, you can specify an argument (prefix=) that indicates where the package will be installed:

make && sudo make install prefix=/usr/local/stow/(package-name)

Enabling (Stowing) a package

After installing, you need to enable the package by running this command:

cd /usr/local/stow && sudo stow (package-name)

Disabling (Unstowing) a package

You just need to add -D argument in Stow command to disable a package:

cd /usr/local/stow && sudo stow -D (package-name)

Uninstalling a package

Removing /usr/local/stow/(package-name) folder is a good to uninstall definitively or to upgrade a package. Before doing this, you need to remove symbolic links created by Stow:

cd /usr/local/stow && sudo stow -D (package-name)
sudo rm -R /usr/local/stow/(package-name)

Conclusion

I hope I could help people who had issues to manage different application of a software. Indeed, Stow is certainly a great tool to handle this.

Ixartz logo avatar
ixartz
Sharing Engineering Stuff
Tweet