Logo
Molecular Dynamics Simulation
how to uninstall gromacs

How to uninstall GROMACS on Ubuntu, Linux

Skilltori

Skilltori

5/24/2026 - min read

To completely remove it, you have to clean up where it was compiled and where it was installed. Here is the step-by-step process to wipe it out completely.

Step 1: Use CMake to Uninstall (If you still have the build folder)

If you haven't deleted the ~/gromacs-2026.2/build folder yet, CMake can often automatically track down and delete every file it placed on your system.

  1. Navigate to your build directory:Bash

cd ~/gromacs-2026.2/build

  1. Run the uninstall command:Bash

sudo make uninstall

(If this command throws an error or says "no rule to make target 'uninstall'", don't worry—just move on to Step 2).

Step 2: Manually Delete the GROMACS Installation Files

By default, unless you specifically told CMake to install it somewhere else using a flag like -DCMAKE_INSTALL_PREFIX, GROMACS installs itself into /usr/local/gromacs.

To completely wipe that directory, run:

sudo rm -rf /usr/local/gromacs

If you installed it via Ubuntu's package manager (apt) at some point in the past just to try it, run this to ensure those copies are gone too:

sudo apt purge "gromacs*"
sudo apt autoremove

Step 3: Remove the Source and Build Files

Now, clean up the source code folder in your home directory where you ran the compilation:

rm -rf ~/gromacs-2026.2

(If your folder had a slightly different name, like gromacs-2026, adjust the name accordingly).

Step 4: Clean up your Environment Variables (Bashrc)

When setting up GROMACS, users often add a line to their environment to make the gmx command work everywhere. Let's make sure that's cleaned up so it doesn't leave broken links behind.

  1. Open your bash configuration file:Bash

nano ~/.bashrc

  1. Scroll to the very bottom of the file and look for a line that looks like this:Bash

source /usr/local/gromacs/bin/GMXRC

  1. If you see it, delete that line.
  2. Press Ctrl + O then Enter to save, and Ctrl + X to exit the editor.
  3. Apply the changes to your current terminal:Bash

source ~/.bashrc

At this point, GROMACS is 100% purged from your system! If you type gmx, your terminal should return a command not found error.

Tags: