Compiling atlas for the Mac using MacPorts

You
are going to install the gcc C compiler (provided by MacPorts), which is preferred for
installing atlas and realex. To do so you must first install the XCode
C Compiler. See C Compilers for the Mac
for an explantion.

(1) Install MacPorts. (If MacPorts is installed on your system go to
step (2).
Visit macports.org, go to
Installing MacPorts,
and
download
the dmg file for your version of MAC OSX (for example 10.7.*=Lion).
Double click on the dmg file to install MacPorts. You need to be
an administrative user, and will need to enter your password.

(2) Install the XCode C compiler.
If you already have XCode installed, go to step (3) (XCode is not
installed by default).

The XCode package is huge, and includes a lot of
unnecessary tools. We recommend downloading and installing
just the
XCode command line
tools, which have everything you need. Alternatively install
the entire Xcode
package. In either case you will need
a (free) Apple ID.

Once you have installed XCode, or just the command line tools, you
will have a C compiler /usr/bin/gcc.

(3) Install the MacPorts (gcc) C Compiler

Open a terminal window (Terminal is available in Applications).
All further commands are given from within this window.
Give the command:

sudo port install gcc46

to install the the macports version of gcc. If you are using only the
command line tools of Xcode (not the full XCode installation) ignore
the warning about not finding XCode. After a few minutes you should
have /opt/local/bin/gcc-mp-4.7 (the MacPorts C compiler)
and /opt/local/bin/g++-mp-4.7 (the MacPorts C++ compiler).
Also this directory has been added to your PATH
environment variable.

(4) Install readline

Do:

sudo port install readline

to install the readline package.

(5) Set an environment variable, and change your compiler (or go to 5'):

Set the environment variable rl_libs to be
"-lreadline -lcurses -L/opt/local/lib".

How to do this depends a bit on your shell. echo $SHELL will
tell you your shell. If your shell is bash (and many others) add
this line to your .profile file in your home directory (create such a
file if id doesn't exist)"

export rl_libs="-lreadline -lcurses -L/opt/local/lib"

For the c-shell and variants do this:

setenv rl_libs "-lreadline -lcurses -L/opt/local/lib"

The default mac compiler, /usr/bin/g++ doesn't work.
To change the compiler, do this:

If you downloaded a tar/tgz file from the download
page at google, you should not need to install
cwebx. If you downloaded the software using git, cweb is needed to
compile
realex. cwebx is included in this distribution in the directory
cweb-x3.51,
or from
www-math.univ-poitiers.fr/~maavl/CWEBx.

Running make should compile cwebx, and produce the executables
cweb-x3.51/ctanglex and
cweb-x3.51/cweavex. The file sources/interpreter/Makefile tells the
compiler
to look for these executables. If you move the cweb-x3.51 directory,
or want to use different versions you must edit this Makefile.

Also, you need to have a working copy of tex in your path to run
cweavex.