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:~# 
1

1 Answer 1

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.

4
  • 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:~# Jan 10, 2014 at 17:36
  • Precisely. Answer updated.
    – jlliagre
    Jan 10, 2014 at 17:40
  • I see. So I guess the question now is why did the cmake installer put the thing in /usr/local/bin. Ah well, I can fix that. Thanks. Jan 10, 2014 at 17:45
  • Actually I take that back. All I had to do was log back in to my shell. Jan 10, 2014 at 17:46

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