Guide to Installing SDDS and AOP Simulation Software on MacOS Computers

Authors: Michael Borland, Robert Soliday and Hairong Shang
Packagers: Robert Soliday

If you encounter any installation issues, please [email protected].

Preferred Installation Steps

  1. Download and Install XQuartz:

    Visit www.xquartz.org to download and install XQuartz.

  2. Download AOP Software:

  3. Unpack the Downloaded Files:

    In Terminal, navigate to your download directory and run the following commands:

    mkdir ~/sdds
    mv *.tar.gz ~/sdds/
    cd ~/sdds
    tar -xf *.tar.gz
    wget https://ops.aps.anl.gov/downloads/defns.rpn

    This will unpack the programs into ~/sdds/darwin-aarch64 or ~/sdds/darwin-x86 and ~/sdds/oagtcltk.

  4. Set Up Environment Variables:

    Edit your ~/.profile file to include the necessary environment variables.

    export EPICS_HOST_ARCH=darwin-aarch64
    export HOST_ARCH=darwin-aarch64
    export PATH=$HOME/sdds/darwin-aarch64:$HOME/sdds/oagtcltk/usr/bin:$PATH
    export TCLLIBPATH=$HOME/sdds/oagtcltk/usr/lib/oag:$HOME/sdds/oagtcltk/usr/lib
    export RPN_DEFNS=$HOME/sdds/defns.rpn
  5. Install the sdds Python module (optional):

    The sdds is available through either PyPI or Anaconda

    PyPI Package:

    python -m pip install soliday.sdds

    Conda (Anaconda) Package:

    conda install soliday::sdds
  6. Verify Motif Plotting Program:

    If you installed oagtcltk, you will have mpl_motif in your path. Note that Motif may have compatibility issues with newer versions of XQuartz.

    Run mpl_motif to check:

    mpl_motif

    If you encounter an error, try the following workaround:

    export DYLD_LIBRARY_PATH=/opt/X11/lib/flat_namespace

    If mpl_motif still doesn't work, you can use sddsplot with the -device=png -output=sddsplot.png options to generate plots directly to a file.

 


 

Compiling from Source Code

Step 1: Configure the environment

Update ~/.profile

export PATH=$(HOME)/epics/base/bin/darwin-aarch64:$(HOME)/epics/extensions/bin/darwin-aarch64:$(HOME)/oag/apps/bin/darwin-aarch64:$PATH
export HOST_ARCH=darwin-aarch64
export EPICS_HOST_ARCH=darwin-aarch64
export RPN_DEFNS=$(HOME)/.defns.rpn

Step 2: Install MacPorts or Homebrew packages

MacPorts

sudo port install openmotif xorg-libXp libdeflate fftw-3 gd2 gsl libiconv libjpeg-turbo xz ncurses libpng tiff zlib zstd

Homebrew

sudo brew install openmotif libXp libdeflate fftw gd gsl libiconv jpeg-turbo xz ncurses libpng libtiff zlib zstd

Step 3: Download and compile EPICS/Base, SDDS ToolKit, SDDS EPICS Toolkit, OAGTcl/Tk, and Elegant

cd ~
mkdir epics
cd epics
curl -O https://epics.anl.gov/download/base/base-7.0.8.1.tar.gz
tar -xf base-7.0.8.1.tar.gz
rm base-7.0.8.1.tar.gz
ln -s base-7.0.8.1 base
git clone https://github.com/epics-extensions/extensions
cd ..
curl -O https://ops.aps.anl.gov/downloads/defns.rpn
curl -O https://ops.aps.anl.gov/downloads/SDDS.5.7.tar.gz
curl -O https://ops.aps.anl.gov/downloads/SDDSepics.5.6.tar.gz
curl -O https://ops.aps.anl.gov/downloads/oag.apps.configure.tar.gz
curl -O https://ops.aps.anl.gov/downloads/oag.1.29.tar.gz
curl -O https://ops.aps.anl.gov/downloads/elegant.2024.1.0.tar.gz
tar -xf SDDS.5.7.tar.gz
tar -xf SDDSepics.5.6.tar.gz
tar -xf oag.apps.configure.tar.gz
tar -xf oag.1.29.tar.gz
tar -xf elegant.2024.1.0.tar.gz
rm SDDS.5.7.tar.gz
rm SDDSepics.5.6.tar.gz
rm oag.apps.configure.tar.gz
rm oag.1.29.tar.gz
rm elegant.2024.1.0.tar.gz
mv defns.rpn .defns.rpn
cd epics/base/configure
echo "SHARED_LIBRARIES=NO" >> CONFIG
echo "LINKER_USE_RPATH=NO" >> CONFIG
echo "COMMANDLINE_LIBRARY=" >> CONFIG
echo "CC=clang" >> CONFIG
echo "CCC=clang++ -std=c++11" >> CONFIG
echo "LDLIBS_READLINE=" >> CONFIG
setopt interactivecomments
#These paths are specific to MacPorts so we can locate the needed libraries
#If you are using Homebrew then you will need to change
#/opt/local to /usr/local for Intel Macs or /opt/homebrew for Apple Silicon
echo "OP_SYS_INCLUDES += -I/opt/local/include" >> CONFIG
echo "OP_SYS_LDFLAGS += \$(addprefix -L,\$(dir \$(firstword \$(wildcard /opt/local/lib/*))))" >> CONFIG
cd ..
make -j
cd ../extensions/configure
make clean all
cd ../src/SDDS
make clean
make -j
make
cd ../oagca
make clean
make -j
cd ../SDDSepics
make clean
make -j
cd ../../../..
cd oag/apps/configure
echo "EPICS_BASE=$(dirname $(dirname $(dirname $(pwd))))/epics/base" >> RELEASE
echo "EPICS_EXTENSIONS=$(dirname $(dirname $(dirname $(pwd))))/epics/extensions" >> RELEASE
make clean all
cd ../src/utils/tools
make clean
make -k
cd ../../tcltklib
make clean all
cd ../tcltkapp/oagapp
make clean all
cd ../../physics
make clean
make -j
cd ../xraylib
make clean
make -j
cd ../elegant
make clean
make
cd elegantTools
make clean
make
cd ../sddsbrightness
make clean
make

Additional Resources