N.B. This document is preliminary, incomplete, and goes out of date
with alarming frequency. Please contact Scott Mitchell ("smitch at mac dot com")
with suggestions or questions about the document.
(DRAFT version - Apr 28, 2004)
GRASS GIS on Mac OS X
GRASS on Mac OS X shares all the functionality enjoyed on other UNIX-
or Linux-based platforms. There are quirks to the operating system
that occasionally pose challenges when new features are added or changed
in the GRASS source code, but these are usually sorted out promptly.
In addition, due to the fact that Mac OS X has evolved quite differently
from other UNIX systems, there is a variety of ways to get GRASS installed
on a Mac. This page is an attempt to help you navigate through the
options. Some assumptions are made about your familiarity with GRASS,
in that we are not re-explaining things here that are found in other pages
on the GRASS web site.
Main Issues: UNIX/X11-based or Aqua-based ?
No matter which method you choose to get GRASS working on your system,
the following issues may come up. MacOS X has a split heritage - the
user interface that came from the marriage of Apple and NeXT, and the UNIX
tradition that came in through FreeBSD. This means that there are multiple
alternatives for developing user interfaces to applications. GRASS comes
from a UNIX and X11 heritage. The tools that are used in the standard
(i.e. shared with other platforms) GRASS user interface are now all readily
available on the Mac, but there are also alternatives.
Therefore, building GRASS requires a decision on whether or not GRASS will
use features that are exclusive to Apple's graphic interface ("Aqua").
This allows more seamless integration in to the Apple environment, but requires
work "outside" of the main GRASS development to make it work. If you
use the R statistics package, this
may sound familiar - there have long been projects alongside the main development
stream to enhance R by using capabilities of the Mac environment.
For GRASS, such work has been concentrated in the efforts of Joshua Lecock's
Open OS X port of GRASS, which uses
an Aqua version of the Tcl/Tk interface so that the menuing system has a
consistent look and feel to other Macintosh products. It also provides
a software installation CD, subscription and support options, and various
bundles with other traditonally-UNIX software packages. A Sourceforge project for porting GRASS to
Quartz and GNUstep has also been started, and is looking for programmers,
if you have the skills and interest.
The alternative approach is to stick with the X11 interface that is shared
amongst other UNIX systems, in which case GRASS will look and behave pretty
much the same as on other platforms. In the past, this required the
user to have X11 from another source installed and running properly, but
now (as of OS 10.3 "Panther") Apple includes X11 with the operating system,
combining XFree86 with a window manager that is integrated with the Aqua
graphics system. So if you have this version of the operating system,
the windows that you run GRASS in can now all be part of the normal Mac windowing
system, although if you want the graphical menuing system (which is an optional
way to run GRASS), it will use standard X11-based Tcl/Tk, and requires that
you have that installed separately. If you are still using OS 10.2
("Jaguar"), you can install X11 separately a number of ways (see below).
In recent discussions on the GRASS development mailing list, it has been
noted that things would be simpler if tcltkgrass, the GRASS menuing system,
were modified so that it could be used without modification in the Aqua
port of Tcl/Tk instead of requiring the UNIX version. So this may
be changed in the near future, but in the meantime the issues above still
apply. It has also been noted that the NVIZ visualization tool will
continue to require the UNIX version of Tcl/Tk.
These issues have contributed to the variety of versions you can install,
whether you choose a binary installation or to compile from source. The
prerequisites for each option vary slightly.
Prerequisites
All platforms require a number of external packages to make GRASS work,
either at all, or to its full potential. Some of these are provided
in a base Mac OS X system (the number of which has gone up over time), whereas
others are easily available as downloaded binaries or source code. The
requirements for compiling the software yourself are more complicated and
are discussed first. If you are going to install pre-compiled binaries
you can skip to the "Binaries" section of this document.
Requirements to compile GRASS:
If you are going to do any compiling of software, you will need the development
tools, available free from Apple. This package was called Development
Tools for OS X versions 10.0-10.2, and "Xcode tools" when 10.3 ("Panther")
was released. It is on a separate install CD in the Panther package
and either on CD or available for download for earlier versions.
The general prerequisites for all platforms are listed in the
GRASS requirements page.
Of these, all of the aboslutely required elements (e.g.
the compiler/build system, and the zlib libraries) are provided by Apple.
As discussed above, the X11 window system is provided by Apple as an optional
install starting in OS X 10.3. For Mac OS X 10.2 (or earlier), you
can install XFree86 using the fink
or DarwinPorts package manager
systems, or compile it yourself from source.
The package manager systems are an easy way to find, compile where necessary,
and install ports of unix software on to a Mac OS X system. If you
have used Cygwin on a Windows machine, or RedHat, Debian, etc. on a Linux
machine, you are probably already aware of their package managers.
On the Mac, you can choose from at least fink or DarwinPorts. Fink uses
the same tools as Debian Linux (apt-get, dpkg). DarwinPorts is more
similar to the FreeBSD Ports project. The initial author of this document
chose fink because I was already used to Debian, but others have also reported
satisfaction with DarwinPorts. You should read the web pages for those
two projects to learn about the differences between them, and how to install
and use them.
As of OS X version 10.3, Apple provides suitable versions of FreeType
2 and OpenGL (if you have the Apple X11 installed).
The rest of the optional requirements can be downloaded as source and
compiled "manually", or installed with either of the package management
systems (is this true of all the packages in DarwinPorts?). In fink,
the packages you would need are: libtiff libtiff-shlibs libpng3 libpng3-shlibs
libjpeg libjpeg-shlibs tcltk tcltk-dev tcltk-shlibs gd2 gd2-shlibs gdal gdal-dev gdal-shlibs (but see special
note re: GDAL below) netpbm netpbm-shlibs postgresql postgresql73-dev unixodbc2
unixodbc2-dev, and r-base (for the R language link to GRASS - note
that this installs the X11/UNIX version of R, not the Aqua version).
GDAL deserves special mention,
because the version that is generally available either as "released" source
code, or as a fink package as of this writing is quite far behind the current
development version, and it is the current versions of GDAL that are used
in GRASS development. This tool and its use in GRASS is updated quite
frequently, therefore if you don't have the most recent version of GDAL when
you are trying to compile GRASS, there's a good chance that r.in.gdal compilation
will fail, or that the tool will not work as expected. Therefore it
is recommended that you install a relatively recent binary version of GDAL
(e.g. http://wwwamb.bologna.enea.it/forgrass
)or compile from a recent version of the sources available via anonymous
CVS. The r.in.gdal command is extremely useful for importing a
wide variety of spatial data formats, so it is worthwhile spending the extra
effort to get this working if you will have any data import tasks.
Tcl/Tk is required for the tcltkgrass menu/GUI system, and for the NVIZ
visualization tool. At this time, GRASS distributed from the GRASS project
sites does not work with the Tcl/Tk that is available for Apple's Aqua window
environment, so you will need the UNIX version of Tcl/Tk to build GRASS from
source. Hopefully, changes will soon be made that would allow tcltkgrass
to use Aqua
Tcl/Tk, but apparently making NVIZ work would be much more complicated
(see mailing list traffic on this topic). You can install the tcltk
package from fink, or it can be easily built from source (get source from
the
Tcl/Tk sourceforge project.
The PROJ library also
builds cleanly from source on the Mac platform.
Some additional notes on configuring GRASS to compile on a Mac are now available
here - additional contributions welcome. William Kyngesburye provides his experiences and instructions for building GRASS here. His approach includes downloading and compiling the required prerequisites as well, but should also be useful if you're using a package manager.
Binary releases of GRASS for Mac OS X
1) Binary releases from the GRASS site - There are binary
packages available from the GRASS downloads area
of this site. When these binary packages are constructed, reasonable
efforts are made to package everything you need into a single download and
install process. For example, the GDAL library discussed above is
included. Some of the other GRASS modules that interface with other
software packages will require separate installations for normal functionality.
Such external packages include PostgreSQL (for the PostgreSQL database interface),
Unix ODBC (for the ODBC database interface), and Tcl/Tk 8.x (for the graphical
menu system and the NVIZ visualization tool). In addition, the Tcl/Tk
is sometimes version-sensitive, therefore your installation version may
need to match that used by the person that made the binaries. There
are 2 files to download, a large compressed archive with the required files
(a .tar.gz file), and a script file that will manage the installation process.
You need to download both files intact (i.e. don't let your browser
call on Stuffit Expander or any other decompression tool to process the .tar.gz
file), and then go to a Terminal window to run the install script. See
the README file in the download area for further details. Pros/cons
- this method provides the closest experience to those on other platforms.
Therefore instructions that you may see in other web pages or in books
about GRASS will match as closely as possible. On the other hand, this
takes advantage of very little of the "extra features" of the Mac OS - you
need to use the UNIX terminal to install and run GRASS, and you need to have
the extra packages mentioned above for full functionality. If you are
going to do any other UNIX work on your machine, however, these other tools
will be generally useful, and if you are one of the "new Mac users" that
came to Macs from UNIX platforms, this is probably the most familiar route
for you. This option is also most likely to be the quickest to incorporate
the latest developments in the main GRASS code.
Note that the package managers discussed in the above section on installing
from source code can also be useful for installing these extra software
packages. In some cases they will allow you to stick with "all-binary"
installations, not requiring anything to be compiled - fink, for example,
can do this using the apt-get command or using the "Fink Commander" graphical package
management tool. Even if what you are after is not available in a binary
format, the package managers provide an "intermediate" solution, in that
as long as you have the development environment installed, they can take
care of the downloading and compiling of the sources and the installation
of the resulting binaries automatically. If you use Fink Commander,
this is all managed within the Mac GUI, without having to navigate a UNIX
shell prompt.
2) GRASS from Fink - it should be noted that GRASS itself is
available as a package, in the Fink system, although as of this writing
it is also still at version 5.0.2. It would be wonderful to get that
updated, and to also have packages that install the development version
5.3 and the experimental 5.7. But all of this requires scarce volunteer
time.
3) Open OS X - The Open
OS X port of GRASS is a binary release with extra functionality, but
its maintenance and documentation is a parallel, separate activity (which
has contributed back some very useful fixes to the main GRASS project).
As of this writing, it is still using version 5.0.2 of GRASS.
4) Lorenzo Moretti's "one stop" solution - A relatively new
solution has recently been made available from Lorenzo Moretti, at http://wwwamb.bologna.enea.it/forgrass/
which provides all of the software you need to run GRASS 5.3 and GRASS 5.7
on any Mac with OS 10.2.8 or higher and Apple's X11 installed. I have
not had a chance to try this yet, but it looks very promising. I gather
he has adopted many conventions that will be more familiar to longtime Apple
users (e.g. the programs are installed under /Applications instead of the
usual /usr/local/grass5X), and it comes in the form of "one-click" Apple
"packages" (.pkg files) so installation is simple. This is probably
a good option for those wanting to try GRASS that are wary about / inexperienced
with UNIX or other command-prompt driven operating systems.