HOWTO build OpenMx from the source repository


General Requirements for compiling OpenMx

Compiling OpenMx requires that you have installed in R the other packages to which we link, or depend. It will be useful to also install suggested packages. Currently, these are:

  • Links
  • RcppEigen
  • Depends
  • methods
  • digest
  • MASS
  • parallel
  • Suggests:
  • snowfall
  • roxygen2
  • mvtnorm
  • rpf
  • numDeriv

Unix installation

OpenMx should compile under any Unix with the GNU C compiler (See above for instructions on installing this if necessary). First you need to get the source.

SVN Source Archive

To install OpenMx, download the source using SVN.

  1. You will want to check out the repository to a local working copy, placed wherever you like, probably a directory such as "~/Applications/bin" or "~/local/"
  2. Next "Check out" the repository creating the local directory OpenMx if necessary:
    cd ~/Applications/bin/
    svn checkout --username <yourUserName>  ""   OpenMx

    If don't have an account, leave out the --username argument.

  3. After you have downloaded an initial working copy, SVN can keep this up to date with svn update.
    	tinkerbell:OpenMx tim$ svn update
    		A    trunk/docs/source/Factor1.png
    		U    trunk/docs/source/FactorModelPath.rst
    		D    trunk/models/passing/bivSat3.R

    A = Added, U = Updated, D = Deleted

    Other codes you might see include B (Broken lock); C (Conflicted); G (Merged); and E (Existed)

    You can also check the status of your working copy

    cd ~/Applications/bin/
    svn status OpenMx  # learn if any changes have been made, including new files

    * For a list of recent changes check out the ChangeLog file in the most recent distribution.

    Learn more with man svn or a tutorial site.

GIT Source Archive

Equivalently, there is a real-time mirror of the OpenMx subversion trunk located at Gitorius. To retrieve a read-only clone of the trunk, use:
git clone git://

Building and Installing OpenMx from the downloaded source

cd (change directory) to the trunk directory, and make install

cd ~/OpenMx/trunk/
make install

Options for the make process are as follows:

make build # build a binary release of the OpenMx library for export.
make install # create the OpenMx library and tries to install it as an R library.
make check # create the OpenMx library and runs the R library checker.
make html # create the Sphinx documentation in the docs/build/html directory.  You will need to have the Sphinx package installed.
make pdf # create a pdf file in the build directory of the OpenMx documentation.
make clean # clean out the build subdirectory.  Sometimes you may need to run "make clean" if you get error messages with the other make build.
make test # run all the models in the demo and models/passing subdirectories.  The number of errors found will be reported (should be 0).

Problems With make

  1. Try make clean
  2. Ensure your copy of the source is up-to-date (to your local copy's trunk directory, and update):
    cd ~/OpenMx/trunk/
    svn update
  3. Checkout the repository again.
  4. Make sure that you are building from the trunk directory.
  5. Make sure you have all the R dependencies installed.
  6. Last but not least, make sure that if you are building for multicore, the command R points to R64, not to plain 32-bit R. For example, if the command

    which R

    returns /usr/bin/R, and

    ls - l /usr/bin/R

    returns /usr/bin/R@ -> /Library/Frameworks/R.framework/Resources/bin/R it would be necessary to fix this with

    sudo unlink /usr/bin/R
    sudo ln -s /Library/Frameworks/R.framework/Resources/bin/R64 /usr/bin/R

    Otherwise, you may encounter cryptic messages such as

    Error in dyn.load(file, DLLpath = DLLpath, ...) : 
      unable to load shared object '/Library/Frameworks/R.framework/Versions/2.14/Resources/library/OpenMx/libs/i386/':
      dlopen(/Library/Frameworks/R.framework/Versions/2.14/Resources/library/OpenMx/libs/i386/, 6): Symbol not found: _GOMP_parallel_end
      Referenced from: /Library/Frameworks/R.framework/Versions/2.14/Resources/library/OpenMx/libs/i386/
      Expected in: dynamic lookup

OS X installation

    Installing OpenMx from Source on OS X 10.9.2
  1. Install Xcode from the App Store
  2. Run this command in a terminal window to get standard C libraries etc:
    xcode-select --install

    The command line is used just this first time: The app store will update it thereafter.
  3. Download OpenMx into a directory with the name OpenMx (or whatever you prefer, but this is standard)

    svn checkout --username <yourUserName>  "" OpenMx
    cd OpenMx
    cd trunk

  4. Download & Install R 3.1.1 (3.0.x & 3.0.1 should work too)
  5. In R, if necessary, install required packages:

    You probably should install the suggested packages too
  6. Download HPC g++ gcc * gfortran 4.9 from, change directory to wherever it downloaded, and install it in /usr/local/bin with sudo tar -xvf gcc-4.9-bin.tar -C /
  7. Change to trunk directory of OpenMx repository (or whichever source you want, e.g., in tags)
    cd trunk
  8. Run the following command which will likely fail, but look for the line that says something like "Change default C/C++ compiler and default compile flags by editing /SomeLongPathToADirectory/Makeconf"
    make install  
  9. Edit the file identified in the previous step (in my case it is /Library/Frameworks/R.framework/Resources/etc/Makeconf ) and replace the CLANG compilers with g++ gcc & gfortran, by changing the 4 lines beginning CC, CXX, FC and F77 to read:
    CC = /usr/local/bin/gcc
    CXX = /usr/local/bin/g++
    FC = /usr/local/bin/gfortran
    F77 = /usr/local/bin/gfortran
  10. important get the correct version of NPSOL for your build.
    You will need to find the right right version of libnpsol.a (one copy is appended at the bottom of this wiki page).

    This must be moved to the correct location for the compiler to find it. By default this will be trunk/inst/npsol/osx/

  11. make install
    Now you can make (compile) and install (move the package in R's library folder) OpenMx.

    Again, from the trunk directory, simply run make install Other options for building (like check) are described in full in the unix section above and work for Mac too.

Validate the installation by running make test - it takes some time to complete.

The above steps have been tested on a newly (Aug 5 2014) purchased OS X 10.9.2 system. For subsequent rebuilds from source the procedure is much easier:

cd OpenMx/trunk
svn up
make install

Windows installation

A prerequisite for compiling OpenMx on Windows platforms is the Rtools Windows toolset. Download the latest version of Rtools from their website and run the installer. The Rtools installer does not add the R directory to your PATH environment variable. See here for help on setting the path in Windows 2000/XP. See here for help on setting the path in Windows Vista. The default R directory is placed in C:\Program Files\R\R-2.X.X\bin.

TortoiseSVN is a subversion graphical user interface that you may find helpful. Some tips: We recommend checking out the OpenMx repository into a folder that does not contain any spaces in its absolute path. If you receive a permission denied error when running "make install", follow the instructions on the R FAQ for Windows: I don't have permission to write to the R library directory.

In R 2.9.x and earlier, you need Microsoft's HTML Help Workshop in order to create R help files under Windows. After you have installed the software, add C:\Program Files\HTML Help Workshop to your PATH environment variable.

Now follow the instructions for the Unix installation.


Commits to the source repository are automatically tested by our buildbot.

libnpsol.a.txt439.77 KB