How to Install GROMACS on Linux, Mac and Windows (2026 Guide)

How to Install GROMACS on Linux, Mac and Windows (2026 Guide)

GROMACS runs from the command line — there’s no installer to double-click. This guide walks through every installation method across all three platforms, with exact commands, what the output should look like, and fixes for the errors most beginners hit.

Before you start: two installation methods

There are two ways to install GROMACS: via conda (fast, handles all dependencies automatically, recommended for most users) or by building from source (more steps, but required if you want GPU acceleration with CUDA). This guide covers both.

Which method should you use?
Conda install: Best for getting started quickly, running MD on CPU, or if you’re not sure whether you need GPU support. Takes about 5 minutes. Works on all platforms.

Build from source: Required for GPU-accelerated simulations on NVIDIA hardware via CUDA. Takes 20–40 minutes. Strongly recommended if you’re on a Linux machine with a CUDA-capable GPU — the performance difference is significant.

If you’re on a university HPC cluster, GROMACS is almost certainly already installed as a module. Check with module avail gromacs before installing anything yourself.

Installing on Linux

🐧
Linux
Ubuntu / Debian / CentOS / RHEL

Method 1: conda (recommended for beginners)

1
Install Miniconda if you don’t have it
Check first: conda --version. If not installed:
Terminal
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
# Follow prompts, accept license, say YES to conda init
source ~/.bashrc   # reload shell
2
Create a dedicated environment and install GROMACS
Always use a separate conda environment to avoid dependency conflicts:
Terminal
conda create -n md python=3.11 -y
conda activate md
conda install -c conda-forge gromacs -y

This installs the CPU-only version of GROMACS. Installation takes 2–5 minutes depending on your connection.

Method 2: build from source with CUDA GPU support

Use this method if you have an NVIDIA GPU and want full CUDA acceleration — typically 5–10× faster than CPU-only for production simulations.

1
Install prerequisites
Terminal (Ubuntu/Debian)
sudo apt update
sudo apt install -y cmake gcc g++ libfftw3-dev
# CUDA toolkit must already be installed
# Verify: nvcc --version
2
Download and extract the GROMACS source
Terminal
wget https://ftp.gromacs.org/gromacs/gromacs-2024.3.tar.gz
tar xf gromacs-2024.3.tar.gz
cd gromacs-2024.3
3
Configure, build and install
Terminal
mkdir build && cd build

cmake .. \
  -DGMX_BUILD_OWN_FFTW=ON \
  -DREGRESSIONTEST_DOWNLOAD=ON \
  -DGMX_GPU=CUDA \
  -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda \
  -DCMAKE_INSTALL_PREFIX=/usr/local/gromacs

make -j$(nproc)
sudo make install
source /usr/local/gromacs/bin/GMXRC

The -j$(nproc) flag uses all available CPU cores to compile — on an 8-core machine this reduces compile time from ~30 minutes to ~5. Add the source line to your ~/.bashrc so GROMACS loads automatically in every new terminal session.

Installing on macOS

🍎
macOS
macOS 12 Monterey or later — Intel and Apple Silicon (M-series)

The conda method is the recommended route on macOS. Building from source on Mac is possible but involves additional Homebrew dependencies and is not worth the complexity unless you have a specific need. Note that NVIDIA CUDA is not available on macOS, so GPU acceleration via CUDA is not an option regardless of installation method.

1
Install Miniconda (if not already installed)
Apple Silicon (M1/M2/M3/M4) Macs need the arm64 installer. Intel Macs need x86_64.
Terminal — Apple Silicon
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh
bash Miniconda3-latest-MacOSX-arm64.sh
Terminal — Intel Mac
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
bash Miniconda3-latest-MacOSX-x86_64.sh

Follow the prompts, accept the license, and say yes to conda init. Restart Terminal when done.

2
Create environment and install GROMACS
Terminal
conda create -n md python=3.11 -y
conda activate md
conda install -c conda-forge gromacs -y
Apple Silicon performance
The conda-forge GROMACS build runs natively on Apple Silicon (arm64) and performs well for small to medium systems. For large production simulations, a Linux machine with a GPU is significantly faster — macOS is best used for setup, testing, and learning rather than long production runs.

Installing on Windows

🪟
Windows
Windows 10 / 11 — via WSL2 (recommended) or native

GROMACS on Windows is best run through WSL2 (Windows Subsystem for Linux 2) — a full Linux environment that runs inside Windows without any performance penalty. This is the approach used by most researchers on Windows machines because it gives you a proper Linux terminal with full GROMACS functionality including GPU support.

Method 1: WSL2 + conda (strongly recommended)

1
Install WSL2
Open PowerShell as Administrator and run:
PowerShell (Administrator)
wsl --install
# Restart your computer when prompted
# On restart, Ubuntu will open and ask you to set a username/password
2
Inside WSL2 Ubuntu, install Miniconda and GROMACS
Follow the Linux instructions exactly — you’re now in a Linux environment:
WSL2 Ubuntu terminal
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
source ~/.bashrc
conda create -n md python=3.11 -y
conda activate md
conda install -c conda-forge gromacs -y

Method 2: native Windows binary (simpler, but limited)

Pre-compiled Windows binaries are available from the GROMACS website for those who prefer not to use WSL2. Download the .zip from gromacs.org → Installation → Windows, extract to C:\gromacs\, and add it to your system PATH. This method works for learning but lacks GPU support and some advanced features.

GPU acceleration setup

If you installed via conda on Linux and want to enable CUDA GPU support without building from source, conda-forge provides GPU-enabled GROMACS builds:

Terminal (Linux with CUDA GPU)
# Install CUDA-enabled GROMACS via conda-forge
conda install -c conda-forge gromacs "gromacs=*=cuda*" -y

# Verify GPU is detected
gmx mdrun -ntmpi 1 -gpu_id 0 -h 2>&1 | head -5

Confirm GROMACS can see your GPU by checking the output of a test run — it should mention GPU offloading in the log file. If no GPU is reported, your CUDA toolkit version may not match what the conda build expects. Check with nvidia-smi that your GPU driver is working, and ensure your CUDA version matches the conda package.

Verifying the installation

After any installation method, run these three commands to confirm GROMACS is working correctly:

Terminal
# Check version
gmx --version

# Check a specific tool loads
gmx mdrun --help

# Run the built-in benchmark (tests full pipeline)
gmx mdrun -bench 1
Terminal — expected output
user@machine:~$ gmx –version
GROMACS – gmx, version 2024.3
GROMACS is written by:

GROMACS compiled with CUDA support: yes

user@machine:~$

Successful installation — version reported, CUDA support line shows “yes” for GPU builds.

Common errors and fixes

ErrorCause and fix
gmx: command not found GROMACS not on PATH. If conda: run conda activate md first. If source build: run source /usr/local/gromacs/bin/GMXRC and add this line to your ~/.bashrc.
Could not find CUDA toolkit CUDA not installed or wrong path. Verify with nvcc --version. If not found, install CUDA toolkit from developer.nvidia.com. If installed but not found, set -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda explicitly in cmake.
CMake Error: C compiler cannot create executables GCC not installed. On Ubuntu: sudo apt install build-essential. On CentOS/RHEL: sudo yum groupinstall "Development Tools".
libfftw3f.so.3: cannot open shared object FFTW library missing. Install via conda: conda install -c conda-forge fftw. Or use -DGMX_BUILD_OWN_FFTW=ON in cmake to build FFTW as part of GROMACS.
conda activate md fails (not recognized) Conda not initialized in shell. Run conda init bash (Linux) or conda init zsh (macOS default shell), then close and reopen terminal.
Permission denied during make install Installing to system directory without sudo. Either prepend sudo to make install, or change the install prefix to your home directory: -DCMAKE_INSTALL_PREFIX=$HOME/gromacs.
Segmentation fault on first gmx run (macOS) Architecture mismatch. Confirm you downloaded the correct Miniconda installer — arm64 for Apple Silicon, x86_64 for Intel. Check with uname -m.
If nothing else works
Remove the conda environment completely and start fresh: conda deactivateconda env remove -n md → repeat the installation steps. Corrupted conda environments account for the majority of persistent installation failures that aren’t explained by the errors above.

What to do next

With GROMACS installed and verified, you’re ready to run your first simulation. The next step is preparing a protein system — downloading a structure from the PDB, solvating it, adding ions, and generating the topology files GROMACS needs before any dynamics can start.

  • gmx --version returns a version number without errors
  • gmx mdrun --help shows the full flag list
  • GPU builds: “CUDA support: yes” appears in the version output
  • On macOS/Linux: conda activate md is set to run at session start or you know to run it manually
  • On HPC clusters: checked whether GROMACS is already available as a module

Installation complete

GROMACS has no GUI — every simulation is a sequence of command-line steps. The conda install gives you a working CPU version in minutes; building from source with CUDA adds GPU acceleration that makes production simulations 5–10× faster. Either way, the simulation workflow is identical once GROMACS is installed.

Last updated on

Similar Posts

Leave a Reply

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