Uninstall CMake from Compile and Install

Hi CMake Community,

I recently uninstall a cmake on my WSL Ubuntu 22.04.3 and manually download + compile + install a new one following Teo Answer B: https://askubuntu.com/questions/355565/how-do-i-install-the-latest-version-of-cmake-from-the-command-line.

However, I realized that cmake binary files are now in usr/local/bin instead of usr/bin. So I want to remove the current install and reinstall on usr/bin.

However, all the following commands failed to do so.

Could you please advise me on how to properly remove the current install?

Best wishes,


Why do you want to mask the official Ubuntu package with the CMake binary? That’s only going to cause issues if anything wants to install cmake as a package. What harm is it causing in /usr/local?

Hi Ben,

Thank you so much for following up.

I am having issues with installing Trilinos with cmake. And I found most of the software installed by apt-get are in /usr/bin so I suspected that it may be the right place for cmake as well. I also saw some online discussions where cmake is installed under /usr/bin. I don’t know what ‘masking up’ means.

I am, in fact, not sure where is the appropriate place for cmake.

Putting software in a place that the system package manager will conflict with.

CMake’s packages don’t need to live in any specific place; you can extract them anywhere as long as they are moved as a single unit (i.e., don’t copy individual files from the extracted tree around, but feel free to move the entire tree anywhere).

Apologize for asking some additional questions.

I also looked into the bootstrap​ file which I think specifies the installation location on line 244 to usr/local​. If this is the default setting for Ubuntu, I will keep it this way.

However, I am not sure if the current install works properly. My first concern is it cannot be uninstalled. I suppose that if it is functioning correctly on my Ubuntu, I should be able to uninstall it as well. Another reason why I want to reinstall it is that I am suspecting if the current one is not functional.

Also, I am wondering if I use apt-get​ will it be installed in /usr/bin instead?

What indication do you have that it doesn’t work? The tarball packages do not have uninstall scripts; you may be able to use cd $prefix && tar tf $package | xargs rm or something along those lines, but I recommend testing with xargs ls first.