9

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!

1 Answer 1

9

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.

1
  • Thanks!! So simple, but takes hours to discover if you stay in the same shell.
    – floorish
    Jun 3, 2011 at 23:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .