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

 Linux Install (deb/rpm)
 Mac OS X Install
 Unix Install (src code)
 Windows Install
 Other Downloads (share)

Mailing list

Search web/mailinglist

 McStas manual
 Known problems
 C Compilers




Report bugs


McStas Ubuntu live-dvd

McStas Windows installation instructions

The distribution packages for McStas may be downloaded via

Installing McStas 2.4 and later on Windows

See bottom of page for known issues for this platform.


  • Download and install
    • The provided Strawberry Perl package, which also contains the gcc compiler. IMPORTANT: Please uninstall any older version of Perl before attempting to install the McStas bundle!
    • The provided McStas metapackage - important: Right-click and 'Run as Administrator', otherwise you easily get some of the known issues listed below!
    (NOTE: Because of problems with the 64 bit gcc on windows, we only provide a 32bit version on windows!
  • The McStas meta package contains:
    • Python 3 and dependencies (miniconda), also including the gcc compiler.
    • McStas-specific extensions to Perl 5.18
    • McStas code generator, components, instruments and datafiles
    • The new set of Python McStas tools
    • The "classic" McStas perl tools
  • Optionally install iFit to visualize results using a Matlab environment (for free, no license needed).
  • Optionally install a VRML/X3D plotter such as Freewrl or InstantReality.
  • Optionally, you can install the NeXus format libraries to be able to export data files in HDF5.

The Windows installation bundle has no configurable options and defaults to install McStas in

Start it after installation by using the desktop links mcstas-2.4-shell and mcgui-2.4.

After installation, please place this configuration file in your C:\mcstas-2.4\lib\tools\Python\mccodelib folder (hint: run 'start %MCSTAS%' from the terminal and you should get an explorer window in C:\mcstas-2.4\lib)

Windows Subsystem for Linux (Win10 x64 only)

As an alternative to the above approach, you can also run our Debian Linux binaries directly under Windows via the WSL (Windows 10 64bit and newer only.

Description and recipe:

Partnering with Ubuntu Linux, Microsoft has released the (experimental) feature "Windows subsystem for Linux" (WSL), also known as "Bash on Ubuntu on Windows". Read more here and here.

It turns out that it is relatively straightforward to get McStas running under this new feature - thereby overcoming some of the annoyances of McStas on the Windows platform.

To try it out, please follow the below steps

  1. Install a copy of Windows 10 64 bit
  2. Update it beyond "Windows 10 Version 1607" - aka the "anniversary build"
  3. Enable "developer mode" in settings
  4. Use "turn features on or off" to enable "Bash in windows"
  5. Start bash via the start icon / cmd+esc
  6. Install McStas as usual on a Debian systems. Also remember that you can easily install openmpi etc.
  7. Currently (May 2017), the WSL is based on Ubuntu 14.04, so you will likely have to install the package python3-pyqtgraph manually, see issue 471 for how to install a newer version from the 16.04 repos
  8. Install and start the Xming X-server
  9. Turn back to your bash and execute
    • export DISPLAY=localhost:0.0
    • mcgui & or mcgui-py & (or any of the usual McStas commands)

As the feature is considered experimental, you might still find some rough edges, but so far it seems functional and looks very promising!

A few extra tips:

  • An easy way to access your data simulated under Linux is to run from within your Windows home folder, accessible under Linux at /mnt/c/Users/<your_username>.
  • Add Xming to your windows Startup items via "windows+r" key and shell:startup
  • Add the line export DISPLAY=localhost:0.0 to your Linux .bashrc file

Please report any trouble in using these instructions to

Known issues for the Windows platform - mostly obsolete from v. 2.4:

  • You will have issues with Perl if more than one version of Perl is installed at the same time. Please
    • Use the windows add/remove software tool to remove any older version of Perl before installing a new McStas
    • Please fully remove both of the folders c:\perl and c:\strawberry before installing a new McStas
  • Our tool set does not fully support working directories including spaces or other non-ascii characters. If you have an older Windows system with a user account in c:\Documents and Settings we advice you to create and use a working directory on the root of the drive e.g. c:\McStaswork
  • We suggest to use our 32bit package for windows 64 also, since we feel the 64-bin gcc on windows is not mature - gives problems in a few, specific cases. In any case, the 32-bit McStas for windows works perfectly fine on a 64-bit operating system!
  • If you are not able to start any simulation from mcgui - only getting back the mcrun --help or the text "press any key to continue", your Perl is likely not registered access all commandline parameters. This can be remedied by
    • Starting the regedit.exe program
    • Searching for keys with content C:\strawberry\perl\bin\perl.exe
    • Ensure that any entry like that includes a final %* like this:
      HKEY_CLASSES_ROOT\Applications\perl.exe\shell\open\command = "C:\strawberry\perl\bin\perl.exe" "%1" %*
  • If you experience strange behavior from perl/mcgui on Windows like
    1. ppm shell not being able to install the extra Perl packages, i.e. no Tk module on the Perl PATH
    2. mcgui not being able to run / compile a simulation (all you get is mcrun -- help output)
    3. mcgui not being able to access local component files
  • - Then the solution can be to ensure your user has "full control" to the executables in c:\strawberry\perl\bin (Right-click the folder, Properties, Security, Authenticated users -> Edit)
Last modified: Mon May 29 10:24:40 CEST 2017

Last Modified: Monday, 29-May-2017 10:29:15 CEST
Search website mailinglist archive GitHub repos