McXtrace logo

McXtrace - An X-ray ray-trace simulation package

ESRF; SAXSLAB Niels Bohr Institute DTU Physics


 Linux Installation (deb/rpm)
 Mac OSX Installation
 Unix Install (src code)
 Windows Installation

Project Status
 Project Partners
 Project People

Mailing list



Minutes of Meetings

McXtrace Art

About McXtrace



Unix installation page

The distribution packages for McXtrace may be downloaded via

McXtrace 1.2 and later on Unix - from source code

In principle any Unix/Linux distribution should be able to run McXtrace, 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) using ports

N.B. McXtrace will be available on FreeBSD as binary packages shortly. You will then be able to install it simply by: [sudo] pkg install mcxtrace.
  • 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 McXtrace 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 McXtrace source code for Unix systems:
    • wget
    • Unpack the "metapackage" tarball
      tar xzf McXtrace-1.4-UNIX-src.tgz
    • cd mcxtrace-1.4-UNIX-src/
    • Unpack the individual subpackages
      find . -name \*tar.gz -exec tar xzf \{\} \;
    • Next, compile the individual packages you want (minimum set is mcxtrace-1.4-src mcxtrace-comps-1.4-src) using e.g.
      • cd mcxtrace-1.4-src
      • cmake -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/freebsd64.cmake -Denable_mcxtrace=1
      • make
      • sudo make install
For the other McXtrace tool packages, please inspire from the dependencies listed in our BUILD_DEPS.TXT document.

Building from GitHub

Check out a copy via
git clone
then proceed using the instructions below.

Building components of the installation

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, at the 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_mcxtrace 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/mxrun
  • 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_mcxtrace=1 (defines if building McXtrace or her sister McStas)
  • -DCMAKE_INSTALL_PREFIX=/usr/local/
where we have used a 64 bit FreeBSD machine as an example. This should be edied to reflect your target system.

Please report any trouble in using these instructions to

Last modified: Thu Jun 16 10:49:39 CEST 2016

Last Modified: Thursday, 16-Apr-2020 23:46:15 CEST
Search website mailinglist archive SVN repos McCode Trac