The following install was successful (barring yet unseen bugs!) on Mountain Lion. If you wish to skip the fun of compiling by hand, you can follow the instructions below.

Homebrew is a package management system for Mac. It is under active development and has strict policies to protect the user from damage via software. They also seek to protect users from themselves by avoiding sudo commands as much as possible. It is recommended that you do NOT install homebrew alongside other package managers such as macports/fink. It seems to do just fine on its own.

To install homebrew, simply paste the following line into your favorite Mac terminal emulator:

To make sure everything is , run:

Add the following to your shell's 'rc' file to source homebrew programs ahead of the system's default versions:

CVS and GIT are version control systems. You can install them as follows:

Excellent documentation for GIT is available at: https://www.atlassian.com/git/

To compile EMAN2's C++ code, we need to download a compiler. Here we install the homebrew versions of gcc and llvm, which are more up-to-date than those available on Mac by default.

CMake is a family of tools designed to build, test and package software. It is used to generate the Makefiles for compiling EMAN2. We install the homebrew version as follows:

Qt is a graphics library for cross-platform user interfaces.

If you need to incorporate additional qt features, check the output of

to see what else you can include.

Boost is a set of useful, standardized libraries for C++. It is used to generate the Python-C++ interface in EMAN2. Homebrew comes with two 'boost' packages, and we'll need both to generate the libraries required for compiling EMAN2:

The GNU Scientific Library provides a wide range of mathematical routines such as random number generators, special functions and least-squares fitting.

A personal concern is that there is no option to '--enable-float'; however, I have not run into any problems with this yet.

FFTW is a C subroutine library for computing the discrete Fourier transform (DFT) in one or more dimensions, of arbitrary input size, and of both real and complex data (as well as of even/odd data, i.e. the discrete cosine/sine transforms or DCT/DST). The most recent version is available from homebrew as follows:

The Oracle Berkeley DB family of open source, embeddable databases provides developers with fast, reliable, local persistence with zero administration. EMAN2 uses Berkeley DB as a mechanism for local storage of project metadata.

Oracle has made their most recent version very VERY proprietary. You need an account on their website to download the package, and you need a license to use 6.0.1. Instead, we can use homebrew, but we need to get a previous version since homebrew defaults to 6.0.1 (as of March, 2015). I managed to find instructions on Stack Overflow (https://stackoverflow.com/questions/3987683/homebrew-install-specific-version-of-formula) that explain how to go about this and have reproduced them below:

Now we can install berkeley-db just as we would any other package.

Finally, add the following to your shell's 'rc' file to enable bsddb3 to know where berkeley-db is located:

At this point, I suggest that you refresh your shell.

On Mac OS X 10.8 and later, X11 and Freetype are no longer included by default. Even if you are using an earlier Mac OS X, I recommend installing your own Freetype. Homebrew offers the most recent version of freetype, but we'll need to explicitly include it in our configuration step later on.

FTGL is a free, open source library to enable developers to use arbitrary fonts in their OpenGL applications. We can install it as follows:

The PNG (Portal Network Graphics) format provides lossless-compressed image support. Mac OS X 10.7 Lion ships with libpng 1.5, in which some deprecated features in the PNG API were removed. EMAN2 is being updated to use these new methods. For now, use libpng 1.2 if you are compiling on 10.7.

HDF5 is a data model, library, and file format for storing and managing data. It supports an unlimited variety of datatypes, and is designed for flexible and efficient I/O and for high volume and complex data.

Library for writing JPEG image files. Though optional, it's very easy to install this package:

Library for reading and writing TIFF image files. Install TIFF as follows:

We can easily install 'readline' to parse command history in python as follows:

Here we opt to use the homebrew version of python over the default install built against the system.

This sets up a separate site-packages directory, installs 'pip' (a package management solution for Python), and allows us to 'build' our python library from scratch, incorporating only the components we want/need.

For further project specificity, we could opt for a virtual environment, which can be created after installing:

An explanation of the innerworkings of python virtual environments are beyond the scope of this document; however, you can find more information here: http://docs.python-guide.org/en/latest/dev/virtualenvs/

SIP is a tool that makes it very easy to create Python bindings for C and C++ libraries. It was originally developed to create PyQt, the Python bindings for the Qt toolkit, but can be used to create bindings for any C or C++ library.

PyQt4 provides Python bindings for Qt4.

bsddb3 provides Python bindings for the Berkeley DB API.

Having previously defined the BERKELEYDB_DIR environment variable, we can install bsddb3 with pip very easily:

PyOpenGL provides Python bindings for OpenGL. There is a pip package for it, available here:

For the sake of optimization, pip also possesses an acceleration package that you can install in addition:

IPython provides a rich toolkit to help you make the most out of using Python interactively. EMAN2 uses iPython for the "e2.py" interactive interpreter environment.

For more details about ipython and its many growing features, see: http://ipython.org/

If you're interested in any of the recent developments in reproducible research and web/cloud-based python programming, I suggest using the following line to install ipython

and checking out the 'Jupyter' project online: http://jupyter.org/

Matplotlib is a python 2D and 3D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments. It can be installed with the following line:

For examples and inspiration, see: http://matplotlib.org/gallery.html

Homebrew has a version of readline; however, so does python. We install it here, too, for good measure.

Cleaning things up and ensuring that everything has been installed properly, run:

Most warnings observed when running 'brew doctor' are harmless, especially if you don't use homebrew extensively. Unless problems arise later on, we recommend ignoring them.

First, obtain the EMAN2 source either via a stable source release, the nightly source release, or using CVS (if you have access permissions; a CVS tutorial is beyond the scope of this document).

Download EMAN2 from the NCMI: http://ncmi.bcm.tmc.edu/ncmi/software/software_details?selected_software=counter_222

Next, check out eman2 from CVS:

1. Get account on blake and be cleared to access CVS

2. Set up CVS variables on .bashrc file:

3. Make 'src' directory wherever you want the source code to be

4. Inside src, make 'build' directory

5. Inside src, download the source code

1. Go to 'build' and type

2. Link all libraries properly.

When using Homebrew, this phase takes a little more care to get right. I suggest comparing your screen to the one I've pasted below:

Once you're happy with the links, press 'c' to configure and then 'g' to generate the makefile.

8. Still inside build type:

9. Add the EMAN2 folder (and the examples folder therein) to your PATH via the .bashrc file

This should do it. If the building process goes through without errors, the basic tests to see whether EMAN2 is actually installed properly, are

10. A) Run e2speedtest.py from the command line 10. B) Run e2.py from the command line 10. C) Run e2display.py from the command line (assuming you're not on a cluster)

If everything went well, the above should run without failure and you can begin using EMAN2. If not, please double check that you've followed all instructions. If you have, feel free to post to the EMAN2 google group for assistance.