McStas logo McStas - A neutron ray-trace simulation package ILL; PSI; ESS Niels Bohr Institute DTU Physics NEXMAP


About McStas
 Conditions of use
 Project funding

 Other Downloads (share)

Mailing list

Search web/mailinglist

 McStas manual
 Known problems



Links <- UPDATED!

Report bugs


Linux installation page This page is obsolete - please refer to our GitHub install pages instead

The distribution packages for McStas may be downloaded via

McStas 2.1 and later on Unix - from source code

In principle any Unix/Linux distribution should be able to run McStas, but we specifically support Debian (.deb) and RedHat (.rpm) binary-package based distributions - see

In case your Unix is not Debian or RedHat like, you should still be able to build either from the source tarball or directly from GitHub. Both methods are examplified below:

Tarball Installation on FreeBSD (tested on PC-BSD 10.0)

  • Install and enable the FreeBSD ports system (see your OS documentation for details)
  • Install the following dependencies via the pkg and ports systems:
    • Base dependencies for McStas code generator:
      sudo pkg install cmake flex bison
    • Dependency for mcgui
      sudo pkg install p5-Tk
    • Dependencies for legacy Perl mcplot/mcdisplay
      sudo pkg install pgplot p5-PGPLOT
    • Dependency for legacy Perl mcplot/mcdisplay PDL must be installed from the ports system using
      • cd /usr/ports/math/PDL/
      • sudo make install
      • cd -
    • Optional dependency for parallelisation
      sudo pkg install openmpi
  • Download and build the McStas source code for Unix systems:
    • wget
    • Unpack the "metapackage" tarball
      tar xzf McStas-2.1-UNIX-src.tar.gz
    • cd McStas-2.1-UNIX-src/
    • Unpack the individual subpackages
      find . -name \*tar.gz -exec tar xzf \{\} \;
    • Next, compile the individual packages you want (minimum set is mcstas-2.1-src mcstas-comps-2.1-src) using e.g.
      • cd mcstas-2.1-src
      • cmake -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/freebsd64.cmake -Denable_mcstas=1
      • make
      • sudo make install
For the other McStas tool packages, please inspire from the dependencies listed in our BUILD_DEPS.TXT document.

Building from GitHub

- check out a copy via
git clone

We build using CMake - which needs to be above version 3.0!

Most of the build dependencies are listed in the file BUILD_DEPS.TXT which is also located in your checked-out folder.

Also top level in that folder you will find a set of helper scripts called build_* which we use to build for e.g. Debian, RedHat, Windows and Mac OS X The script build_src_bin_mcstas should (via common Linux "settings" in the cmake "toolchains" cmake/toolchains/linux*) be able to build most of the packages as .tar.gz bundles.

Each of the sub-packages can also be built directly from the individual folders using a more or less standard CMake approach, e.g.:

  • cd tools/Python/mcrun
  • mkdir tmp && cd tmp
  • cmake ..
  • make
  • make install
The most important settings for cmake building are
  • -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/freebsd64.cmake (defines various system default settings, mostly for the tool configuration)
  • -Denable_mcstas=1 (defines if building McStas or her sister McXtrace)
  • -DCMAKE_INSTALL_PREFIX=/usr/local/

Please report any trouble in using these instructions to

Last modified: Mon Dec 17 18:00:22 CET 2018

Last Modified: Monday, 17-Dec-2018 18:02:12 CET
Search website mailinglist archive GitHub repos