Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So I tried to install Mercurial on Ubuntu 10.04. First I used the ppa repo, but got a pythonpath error, which I gave up on. Next try was install from source, everything went well, except it can't find hg:

$ hg
-bash: /usr/bin/hg: No such file or directory

However, hg is installed in /usr/local/bin/ :

$ which hg
/usr/local/bin/hg

The PATH includes this directory, so why is hg not found?

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

If I execute hg with the full path it works:

$ /usr/local/bin/hg --version

Any help is really appreciated!

share|improve this question

1 Answer 1

up vote 7 down vote accepted

Bash maintains a cache of locations of executables in $PATH. You had hg in /usr/bin at some point, and ran it from that shell. Now you've removed /usr/bin/hg. You need to tell your running shell to forget this location:

hash hg

A new shell wouldn't have this problem, since the cache isn't shared between shell instances.

share|improve this answer
    
Thanks!! So simple, but takes hours to discover if you stay in the same shell. –  floorish Jun 3 '11 at 23:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.