These are instructions for compiling GMAT on Mac OS X as a 32-bit application, using command-line tools. Please note that GMAT is not rigorously tested on this platform. If you find bugs, please submit them to JIRA!

Get the code

Follow the instructions on the Downloads page to check out a copy of the GMAT source code from SourceForge.

We'll refer to the SourceForge checkout as sf.

Get the prerequisites

Toolchain

You'll need the standard GNU toolchain, including GCC and make. The easiest way to do this on Mac is to install XCode (4.3 or earlier) from the Mac App Store.

wxWidgets

GMAT needs a version of wxWidgets with OpenGL enabled and Unicode disabled. This usually means building a custom wxMac library:

  1. Download wxMac 2.8.12 from http://wxwidgets.org.
  2. Unzip and untar the downloaded file.
  3. In a Terminal, run the following commands from the new wxMac-2.8.12 directory (replacing /path/to/wxMac-2.8.12 with the absolute path to your wxMac-2.8.12 directory):
    mkdir build-gmat
    cd build-gmat
    arch_flags="-arch i386"
    ../configure CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" CPPFLAGS="$arch_flags" LDFLAGS="$arch_flags" OBJCFLAGS="$arch_flags" OBJCXXFLAGS="$arch_flags" --prefix=/path/to/wxMac-2.8.12/build-gmat --with-opengl
  4. Run make to compile the wxMac libraries:
    make
  5. Run make install to install the libraries and correctly set install paths.   (This may not be required in the near future.)
    make install

SPICE

  1. Download ftp://naif.jpl.nasa.gov/pub/naif/toolkit//C/MacIntel_OSX_AppleC_32bit/packages/cspice.tar.Z.
  2. Uncompress and untar cspice.tar.Z to result in a cspice directory.

f2c

  1. Download from internal repository (internal users only)
  2. Unzip and move the f2c32 directory to your preferred location.

PCRE

  1. Download PCRE from http://www.pcre.org
  2. Unzip and untar the downloaded file
  3. Run the following commands from the extracted pcre-#.## folder:
    ./configure
    make

Configure GMAT

  1. Set the following environment variable:
    PLATFORM=mac
  2. Copy sf/trunk/build/macosx/BuildEnv.mk to sf/src
  3. Edit BuildEnv.mk to set the following variables:
    TOP_DIR: path to the sf directory
    WX_INSTALLED: path to the directory containing wx-config; usually this is the wxMac-2.8.12/build-gmat directory
    WX_LIB_LOC: path to the directory containing the compiled wx libraries; usually this is the wxMac-2.8.12/build-gmat/lib directory
    SPICE_DIR: path to the directory containing the cspice directory
    F2C_LOC: path to the directory containing the f2c32 directory
    PCRE_LIB_LOC: path to the PCRE library location; usually pcre-#.##/.libs

Configure the bundled plugins

The public GMAT repository (on SourceForge) includes several plugins that can be compiled along with the main application.

MatlabInterfacePlugin (not currently available)

The MatlabInterfacePlugin is available on OS X Leopard (10.5) and Snow Leopard (10.6) only.

  1. Copy sf/plugins/MatlabInterfacePlugin/build/mac_snowleopard/MatlabInterfaceEnv.mk (or mac_leopard) to sf/plugins/MatlabInterfacePlugin/src.
  2. Edit the new sf/plugins/MatlabInterfacePlugin/src/MatlabInterfaceEnv.mk file:
    WX_INSTALLED: path to the directory containing wx-config; usually this is the wxMac-2.8.12 directory
    MATLAB_DIR: path to a MATLAB app (such as /Applications/MATLAB_R2012a.app)


Plugin configuration: To use the MATLAB interface plugin, you must have the following environment variable configured:
MATLABFORGMAT=/path/to/MATLAB_ver.app
You can do this system-wide by putting the variable and its value into the file ~/.MacOSX/environment.plist using the OS X Property List Editor. See Apple QA1067 for details. You'll need to log off and log back on before the setting will take effect. (this does not work in later versions of OS X)

CInterfacePlugin (alpha)

Copy sf/plugins/CInterfacePlugin/build/macosx/CInterfaceEnv.mk to sf/plugins/CInterfacePlugin/src. No extra configuration of this file is necessary.

EphemPropagatorPlugin (alpha)

  1. Copy sf/plugins/EphemPropagatorPlugin/build/macosx/EphemPropEnv.mk to sf/plugins/EphemPropagatorPlugin/src.
  2. Edit the new sf/plugins/EphemPropagatorPlugin/src/EphemPropEnv.mk file:
    SPICE_DIR: path to the directory containing cspice

EstimationPlugin (alpha)

Copy sf/plugins/EstimationPlugin/build/macosx/OdEnv.mk to sf/plugins/EstimationPlugin/src. No extra configuration of this file is necessary.

EventLocatorPlugin (alpha)

Copy sf/plugins/EventLocatorPlugin/build/macosx/EventLocatorEnv.mk to sf/plugins/EventLocatorPlugin/src. No extra configuration of this file is necessary.

ExtraPropagatorsPlugin (alpha)

  1. Copy sf/plugins/ExtraPropagatorsPlugin/build/macosx/ExtraPropagatorEnv.mk to sf/plugins/ExtraPropagatorsPlugin/src.
  2. Edit the new sf/plugins/ExtraPropagatorsPlugin/src/ExtraPropagatorEnv.mk file:
    GMAT_CODE_LOCATION: path to sf/src
    GMAT_BIN_LOCATION: path to sf/application/bin

FminconOptimizerPlugin

The FminconOptimizerPlugin is not available on Mac OS X.

Build GMAT

  1. Change to the top-level sf directory
  2. Run make

Configure and build the internal plugins

available internally only