Installing and Running MadX

In one of the homework sets, we will be using the MADX accelerator modeling program, the current incarnation of "Methodical Accelerator Design" (MAD).  This program has been around a long time, but it is still a standard tool for lattice design.  More importantly, its lattice description syntax - although a bit awkward by modern standards - is the lingua franca for lattice description, understood by pretty much all other packages, so it's important to have at least some familiarity with it.

The package is maintained  by CERN here, including extensive documentation.  The program is an old fashioned single executable that runs from the command line and reads input from a text file or files. It's supported on Windows, MacOS, and Linux. Downloading the executables from the the site is a bit awkward, so we have zipped up the three versions here.   Along with each executable is an example file "main_ring.madx", which we'll discuss in class.

Download the appropriate .zip file to you computer, unzip it, and navigate to the directory with the unpacked files in a command window.  Then type:

Windows:

.\madx main_ring.madx

MacOS (including M1 and M2 Macs):

Recent versions of  MacOS are a little fussy about security.  If you try to run it from the command line right away, it might tell you it's not from a known developer and only give you the options to cancel or put it in the trash.  If this happens, select "Cancel", then go to it in the browser, and do <right-click>->Open.  This will bring up the interactive version of MADX.  Exit, and you will now be able to run it from the command line with

./madx main_ring.madx

Linux:

./madx main_ring.madx



This will create the file PostScript file "madx.ps". The PostScript file can be viewed directly with Document Viewer on Linux.  Preview on MacOS no longer views PostScript files and there is no native viewer for Windows.

For Mac, you can download and install the free program Skim here.

There's no single free solution for Windows that I can find (please let me know if you find one!). The easiest thing to do is to use an online converter to convert it to PDF. There are a lot of these, but I found many of them don’t render the MadX PostScript correctly. This one does a nice job and appears to be completely free.  

If you do want a standalone program, tbe easiest option I found was to do the following.

The resulting file should look like this.

(last modified July 7th, 2026 by Eric Prebys)