\section{INSTALL Installing FreeMat}

\subsection{General Instructions}

Here are the general instructions for installing FreeMat.  First, follow the 
instructions listed below for the platform of interest.  Then, run the
\begin{verbatim}
-->pathtool
\end{verbatim}
which brings up the path setup tool.  More documentation on the GUI elements
(and how to use them) will be forthcoming.  
\subsection{Linux}

For Linux, FreeMat is now provided as a binary installation.  To install it
simply download the binary using your web browser, and then unpack it
\begin{verbatim}
  tar xvfz FreeMat-3.5-Linux-Binary.tar.gz
\end{verbatim}
You can then run FreeMat directly without any additional effort
\begin{verbatim}
  FreeMat-3.5-Linux-Binary/Contents/bin/FreeMat
\end{verbatim}
will start up FreeMat as an X application.  If you want to run it
as a command line application (to run from within an xterm), use
the \verb|nogui| flag
\begin{verbatim}
  FreeMat-3.5-Linux-Binary/Contents/bin/FreeMat -nogui
\end{verbatim}
If you do not want FreeMat to use X at all (no graphics at all), use
the \verb|noX| flag
\begin{verbatim}
  FreeMat-3.5-Linux-Binary/Contents/bin/FreeMat -noX
\end{verbatim}
For convenience, you may want to add FreeMat to your path.  The exact
mechanism for doing this depends on your shell.  Assume that you have
unpacked \verb|FreeMat-3.5-Linux-Binary.tar.gz| into the directory
\verb|/home/myname|.  Then if you use \verb|csh| or its derivatives (like \verb|tcsh|)
you should add the following line to your \verb|.cshrc| file:
\begin{verbatim}
  set path=($path /home/myname/FreeMat-3.5-Linux/Binary/Contents/bin)
\end{verbatim}
If you use \verb|bash|, then add the following line to your \verb|.bash_profile|
\begin{verbatim}
  PATH=$PATH:/home/myname/FreeMat-3.5-Linux/Binary/Contents/bin
\end{verbatim}
If the prebuilt binary package does not work for your Linux distribution, you
will need to build FreeMat from source (see the source section below).  When
you have FreeMat running, you can setup your path using the \verb|pathtool|.  Note
that the \verb|FREEMAT_PATH| is no longer used by FreeMat.  You must use the \verb|pathtool|
to adjust the path.
\subsection{Windows}

For Windows, FreeMat is installed via a binary installer program.  To use it,
simply download the setup program \verb|FreeMat-3.5-Setup.exe|, and double
click it.  Follow the instructions to do the installation, then setup your path
using \verb|pathtool|.
\subsection{Mac OS X}

For Mac OS X, FreeMat is distributed as an application bundle.  To install it,
simply download the compressed disk image file \verb|FreeMat-3.5.dmg|, double
click to mount the disk image, and then copy the application \verb|FreeMat-3.5| to
some convenient place.  To run FreeMat, simply double click on the application.  Run
\verb|pathtool| to setup your FreeMat path.
\subsection{Source Code}

The source code build is a little more complicated than previous versions of FreeMat.  Here
are the current build instructions for all platforms.
\begin{enumerate}
\item  Build and install Qt 4.2 or later - \verb|http://www.trolltech.com/download/opensource.html|

\item  Install g77 or gfortran (use fink for Mac OS X, use \verb|gcc-g77| package for MinGW)

\item  Download the source code \verb|FreeMat-3.5-src.tar.gz|.

\item  Unpack the source code: \verb|tar xvfz FreeMat-3.5-src.tar.gz|.

\item  For Windows, you will need to install MSYS as well as MINGW to
build FreeMat.  You will also need unzip to unpack the enclosed
matio.zip archive.  Alternately, you can cross-build the WIndows version
of FreeMat under Linux (this is how I build it now).

\item  If you are extraordinarily lucky (or prepared), you can issue the
usual ./configure, then the make and make install.
This is not likely to work
because of the somewhat esoteric dependencies of FreeMat.  The configure
step will probably fail and indicate what external dependencies are
still needed. 

\item  I assume that you are familiar with the process of installing 
dependencies if you are trying to build FreeMat from source.

\end{enumerate}
To build a binary distributable (app bundle on the Mac, setup
installer on win32, and a binary distribution on Linux), you will
need to run \verb|make package| instead of \verb|make install|.
