Software & AppsOperating SystemLinux

How To Remove CMake After Installing from Source on Ubuntu

Ubuntu 12

In this article, we will guide you through the process of removing CMake after it has been installed from source on an Ubuntu system. We will cover the steps in detail, providing explanations for each command used.

Quick Answer

To remove CMake after installing it from source on Ubuntu, you can use the "sudo make uninstall" command in the directory where you initially ran "sudo make install". This command will remove the CMake files and directories that were installed. If this method does not work, you can try rebuilding and reinstalling CMake or manually removing the installed files and directories.

Introduction

CMake is an open-source, cross-platform tool that automates the process of building, testing, and packaging software. It controls the software compilation process using simple platform and compiler-independent configuration files. However, there might be instances where you need to uninstall CMake from your system.

Uninstalling CMake

To uninstall CMake, you will need to use the sudo make uninstall command. This command will uninstall the version of CMake that you compiled and installed yourself.

Here are the steps to remove CMake:

Step 1: Open Terminal

First, open a terminal. You can do this by searching for “Terminal” in your system’s application launcher or by using the Ctrl+Alt+T shortcut.

Step 2: Navigate to the Installation Directory

Navigate to the directory where you initially ran the sudo make install command. You can use the cd command to change directories. For example, if you installed CMake in a directory named cmake-build, you would use the command cd cmake-build.

Step 3: Run the Uninstall Command

Next, run the sudo make uninstall command in the terminal. This command will remove the CMake files and directories that were installed. The sudo command is used to run the following command with superuser privileges, while make uninstall is the command that actually uninstalls CMake.

Troubleshooting

If you have already deleted the directory where you installed CMake or made any other changes, you can rebuild and reinstall it to regain the ability to run sudo make uninstall. Follow the same installation steps, starting from the same .tar.gz file and passing the same options to ./bootstrap. After running sudo make install again, you will be able to use sudo make uninstall.

Manual Uninstallation

If you are unable to uninstall CMake using the above method, you can try manually removing the files and directories that were created during the installation. However, this method requires careful identification of the installed files and directories, which can be time-consuming and error-prone.

Conclusion

In summary, to remove CMake after installing it from source, use the sudo make uninstall command in the directory where you ran sudo make install. If that doesn’t work, consider rebuilding and reinstalling CMake or manually removing the installed files and directories.

Remember, not all software installed using make install has an uninstall target. However, CMake does support this feature, so you can safely use sudo make uninstall to remove it.

Always ensure you understand the commands you are running in your terminal, especially when using sudo, as it gives the command full control over your system.

Can I uninstall CMake if I installed it using a package manager like apt?

If you installed CMake using a package manager like apt, you can uninstall it using the package manager’s uninstall command. For example, on Ubuntu, you can use sudo apt remove cmake to uninstall CMake.

Will uninstalling CMake remove all the files and directories associated with it?

Yes, running sudo make uninstall will remove all the files and directories that were installed when you compiled and installed CMake from source.

Can I reinstall CMake after uninstalling it?

Yes, you can reinstall CMake after uninstalling it. Simply follow the installation instructions again to compile and install CMake from source.

Will uninstalling CMake affect other software or projects on my system?

Uninstalling CMake should not affect other software or projects on your system unless they are directly dependent on CMake. However, it’s always a good idea to double-check the dependencies of any software or projects you are working on before uninstalling CMake.

Is it necessary to use the `sudo` command when running `make uninstall`?

Yes, using sudo is necessary because the make uninstall command requires superuser privileges to remove the installed files and directories.

Can I manually remove CMake files and directories instead of using `make uninstall`?

Yes, you can manually remove CMake files and directories, but it can be time-consuming and error-prone. It’s recommended to use the make uninstall command if it’s available to ensure a clean and complete uninstallation.

Leave a Comment

Your email address will not be published. Required fields are marked *