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.
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
Method 1: conda (recommended for beginners)
conda --version. If not installed: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
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.
sudo apt update
sudo apt install -y cmake gcc g++ libfftw3-dev
# CUDA toolkit must already be installed
# Verify: nvcc --version
wget https://ftp.gromacs.org/gromacs/gromacs-2024.3.tar.gz
tar xf gromacs-2024.3.tar.gz
cd gromacs-2024.3
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
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.
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh
bash Miniconda3-latest-MacOSX-arm64.sh
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.
conda create -n md python=3.11 -y
conda activate md
conda install -c conda-forge gromacs -y
Installing on Windows
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)
wsl --install
# Restart your computer when prompted
# On restart, Ubuntu will open and ask you to set a username/password
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:
# 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:
# Check version
gmx --version
# Check a specific tool loads
gmx mdrun --help
# Run the built-in benchmark (tests full pipeline)
gmx mdrun -bench 1
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
| Error | Cause 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. |
conda deactivate → conda 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 --versionreturns a version number without errorsgmx mdrun --helpshows the full flag list- GPU builds: “CUDA support: yes” appears in the version output
- On macOS/Linux:
conda activate mdis 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.