Wednesday, July 01, 2009

Install hg in a custom location

The hg installation scripts allow you do a system-wide installation or an installation in $HOME (~/bin, ~/lib,...). To use a different location, do the following.

The install-home option for make installs hg into $HOME so we redefine the $HOME variable.
export HOME=/home/username/Applications/mercurial-1.2.1/
mkdir $HOME
Then run make.
make install-home
Create symlinks, if desired.
cd /home/username/Applications/bin
ln -s ../mercurial-1.2.1/bin/hg .

Add the following to .bashrc (change appropriately; for example, lib vs lib64, ...).
export PYTHONPATH=$HOME/Applications/mercurial-1.2.1/lib64/python/
export PATH=$HOME/Applications/bin:$HOME/bin:$PATH
Set $HOME back to the original location.
export HOME=/home/username/