Mac VMEC Installation - hiddenSymmetries/simsopt GitHub Wiki
Instructions for installing VMEC on Mac M3
These instructions were written by Misha Padidar on June 12, 2025. If you have trouble with installing VMEC on Mac, feel free to reach out to the author.
- Make a directory to keep everything in,
mkdir project cd project - (Optional) Install
pyenvwithbrew.pyenvis a python version manager. Generally, it is recommended to manage your own version of python rather than use the version of python that comes with your computer.
Then follow the pyenv setup instructions on the pyenv github page.brew install pyenv
- Install python 3.10.1. Python
3.10.1worked during the writing of this document. Typically, you should aim to use a recent version of python, though the installation may not always work with the most recentpyenv install 3.10.1 - Set up
python 3.10.1to be the one used in the local directory,pyenv local 3.10.1
-
Make a virtual environment,
python -m venv env source env/bin/activateThe venv can be activated with
source env/bin/activate. -
Install openmppi and some pip packages
brew install open-mpi python -m pip install numpy python -m pip install cmake scikit-build ninja f90wrap python -m pip install mpi4py -
(Optional) Install simsopt with the MPI connection.
python -m pip install simsopt"[MPI]" -
Install some stuff for working with
VMEC,brew install gcc (this comes with gfortran) brew install scalapack brew install netcdf-fortran brew install openblasAlso install f90wrap dependency meson-python:
python -m pip install meson-python -
clone VMEC2000
git clone [email protected]:hiddenSymmetries/VMEC2000.git cd VMEC2000 -
Modify the
cmake_config_file.jsonto be,{ "cmake_args": [ "-DCMAKE_C_COMPILER=clang", "-DCMAKE_CXX_COMPILER=clang", "-DCMAKE_Fortran_COMPILER=mpif90", "-DNETCDF_INC_PATH=/opt/homebrew/opt/netcdf-fortran/include", "-DNETCDF_LIB_PATH=/opt/homebrew/opt/netcdf-fortran/lib", "-DNETCDF_I=/opt/local/include/netcdf.inc"] }Then install
VMECpython -m pip install . -vIf the install fails, remove the
_skbuilddirectory. Install whatever you need or adjust thecmake_config_file.jsonand try again. Sometimes, the pip install fails for frustrating reasons, in which case, try to build from sourcepython setup.py build_ext python setup.py install -
(Optional) Add the VMEC repository to your
PYTHONPATHso that the directory structure is recognized by python. Modify your.zshrcto contain the following line (replacing the path with the relevant one)`,export PYTHONPATH="your/project/VMEC2000"You can always delete this line if you want to delete the repo. This way you will always be able to load VMEC in python.