2

I am running Ubuntu 12.04, which came with Cmake v 2.8.7.

I had need for a more current CMake, so I downloaded the source for 12.8.12.1, built, and installed it per directions. The last step, make install I ran sudoed.

./bootstrap
make
sudo make install

Now I want to run it, but I find that the old version is still invoked when I execute cmake from the command line:

jdibling@hurricane:/$ cd /; cmake --version; which cmake
cmake version 2.8.7
/usr/local/bin/cmake
jdibling@hurricane:/$ 

Odd, I think. So I su and try it from there:

root@hurricane:~# cd /; cmake --version; which cmake
cmake version 2.8.12.1
/usr/local/bin/cmake
root@hurricane:/# 

Why does which report the same directory, but cmake --version reports different versions? How can I find where the new cmake was actually installed?

As suggested, I ran type:

jdibling@hurricane:/tmp/cmake-2.8.12.1$ type cmake
cmake is hashed (/usr/bin/cmake)
jdibling@hurricane:/tmp/cmake-2.8.12.1$ sudo su -
root@hurricane:~# type cmake
cmake is /usr/local/bin/cmake
root@hurricane:~# 
John Dibling
  • 2,270

1 Answers1

4

You should use the type command to know what is really under its name, i.e.:

type cmake

That might be an alias that run a different version of cmake, or a function with a similar behavior or finally a previously hashed command that in not any more the first one in your PATH, as you experienced.

jlliagre
  • 61,204