\documentclass[12pt,a4paper]{article}

\usepackage[pdftex]{hyperref}
\usepackage[margin=3cm]{geometry}

\setlength{\parskip}{0.5\baselineskip}
\setlength{\parindent}{0pt}

\begin{document}

\begin{center}
  \section*{GAMIT/GLOBK prerequisites}
\end{center}

This information is compiled through experience with first-time users of GAMIT/GLOBK from workshops and elsewhere. Details are provided for installing GAMIT/GLOBK on Linux, Mac and Windows. Additional information is provided on optional programs such as \href{https://www.generic-mapping-tools.org/}{GMT} (required for any GAMIT/GLOBK scripts that produce plots), Tom Herring's \href{http://geoweb.mit.edu/~tah/GGMatlab/}{tsview and velview tools} (requires \href{http://www.mathworks.com/products/matlab/}{MATLAB}) and \href{http://www.pol.ac.uk/home/staff/?user=WillSimoCats}{CATS} (see \href{http://web.mit.edu/mfloyd/www/computing/cats/}{here} also).

\emph{All GAMIT/GLOBK workshop participants must arrive having read through and completed the steps shown on this web page before the start of the workshop.}

This is particularly important given the time and resource constraints when downloading very large package files such as Xcode for Mac users, which will produce unnecessary and unwanted delays.

\subsection*{GAMIT/GLOBK}

In addition to a basic UNIX- or Linux-based operating system, there are four fundamental requirements for installing GAMIT/GLOBK on any system:
\begin{itemize}
  \item a Fortran compiler;
  \item a C compiler;
  \item an X11 library (\texttt{libX11.a}, \texttt{libX11.so} or \texttt{libX11.dylib}); and
  \item an X11 header file (\texttt{Xlib.h}).
\end{itemize}

Many systems will have some or all of these installed by default but others may not. Below are some details about what to expect from various systems that I have experience with.

Once you have completed the steps described for your system, below, you may download and install GAMIT/GLOBK from the source code provided on the FTP server. Further information is available on the main \href{http://geoweb.mit.edu/gg/}{GAMIT/GLOBK web page}.

\subsubsection*{Linux}

There are many different types of Linux system and each is slightly different. However, if you are a Linux user, it is likely that you are familiar with the command line interface, the requirements described above and installing packages as necessary. So I will restrict myself here simply to note a couple of specific points that I am aware of.

It is likely that most Linux systems will have a Fortran and C compliler installed by default.

Beware that some systems (e.g. Ubuntu) may also require installation of csh and tcsh for GAMIT/GLOBK scripts to run. These may be installed quickly and easily through, e.g., the Ubuntu Software Center.

\subsubsection*{Mac}

Apple provides many advanced command line tools with \href{https://developer.apple.com/xcode/}{Xcode}, a package mostly designed for developers of software but which also contains a C compiler and the X11 libraries and headers required for GAMIT/GLOBK. One must be \href{https://developer.apple.com/programs/register/}{registered as an Apple Developer} in order to log in and download Xcode or the Command Line Tools only but the program is free to join and there are no obligations. Note that this is different from the regular Apple ID.

Once registered, \href{https://developer.apple.com/downloads/}{log in}, search for Xcode and download the latest version for your system: 3.1.4 for Mac OS X 10.5 (Leopard); 3.2.6 for Mac OS X 10.6 (Snow Leopard); or 4.5.2 or ``Command Line Tools for Xcode - November 2012'' for Mac OS X 10.7 (Lion) and 10.8 (Mountain Lion), as of the last update of this web page. From February 2012 and Xcode 4.3, \href{https://developer.apple.com/downloads/}{Command Line Tools for Xcode} are available as a separate, smaller download also, which significantly reduces the size of the installation. Note that Xcode, but not the separate Command Line Tools package, is available through the App Store for Mac OS X 10.7.3 (update of Lion) and later.

If using Xcode 4.3.1 or later for Mac OS X 10.7 or 10.8, you must open Xcode (under ``Applications'') and additionally select to install ``Command Line Tools'' in ``Preferences''. If you are using another version of Xcode, I recommend selecting not to install anything except these command line tools in the installation wizard because Xcode is a very large package from which we only require a small number of programs.

Xcode does not include a Fortran compiler but you can install one using the information provided \href{http://web.mit.edu/mfloyd/www/computing/mac/gfortran/}{here}.

As of Xcode 4.4, Apple has also discontinued support of X11. \href{http://xquartz.macosforge.org/}{XQuartz} should instead be installed for the required X Windows libraries and headers described above, which will be placed in \texttt{/opt/X11/lib} and \texttt{/opt/X11/include}, respectively, rather than \texttt{/usr}. However, a link from \texttt{/usr/X11} to \texttt{/opt/X11} is created, so all Mac users should keep the following set in libraries/Makefile.config:

\texttt{X11LIBPATH /usr/X11/lib} \\
\texttt{X11INCPATH /usr/X11/include}

\subsubsection*{Windows}

\href{http://cygwin.com/}{Cygwin} is a common Linux ``emulator'' for Windows which I recommend for installing and running GAMIT/GLOBK. Download and run \href{http://cygwin.com/setup.exe}{setup.exe} to begin installation. Generally the defaults shown throughout the installation process are adequate and need not be changed.

There are, however, specific packages which are required in addition to the default Cygwin packages that are installed. These are at least:
\begin{itemize}
  \item Devel/gcc4-fortran (allowing the required dependencies to be installed will ensure the GCC core packages are also installed, including a C compiler)
  \item Devel/make
  \item Math/bc
  \item Shells/tcsh
  \item X11/libX11
\end{itemize}

I also highly recommend installing the X11/xinit package and its dependencies. This will provide an X Windows environment from which one can open and use, for example, Emacs for creating or editing text files. This is important given then different end-of-line characters between Windows and Unix, Linux and Mac OS X.

\subsection*{Additional software}

There are several additional programs that users may find useful if not necessary to install. The major addition is \href{https://www.generic-mapping-tools.org/}{GMT}, which is required for any GAMIT/GLOBK scripts that produce plots, e.g. \texttt{sh\_plotcrd}, \texttt{sh\_plotvel}, etc. GMT produces Postscript graphics which are most readily viewed using, for example, ``gs'' or ``gv''.

Tom Herring has produced \href{http://geoweb.mit.edu/~tah/GGMatlab/}{GUI-based programs} for time series (\texttt{tsview}) and velocity (\texttt{velview}) viewing and simple manipulation. These are written in, and therefore require, \href{http://www.mathworks.com/products/matlab/}{MATLAB}.

\flushright\emph{Last updated: M Floyd, 2020-01-29, MIT}

\end{document}
