GRASS GIS on Mac OS X

Installation Main

Last change: 2005/8/26
William Kyngesburye <kyngchaos-at-kyngchaos-dot-com>


NOTE: These instructions are for GRASS v6.0.x, but should work with little or no change for GRASS 6.1 CVS. And, read everything here and pay attention.

Introduction

Mac OS X has its roots in UNIX, but that is all hidden and transparent to the user, unlike other 'nix systems. X11 and window managers is not something your average Mac user is exposed to, and package managers are left to others and are not a normal part of the system. There are many common libraries included in Mac OS X, but there are also many that are not or have Mac alternatives (not usually usable as substitutes for 'nix libraries). Even the 'nix developer tools are optional as a part of the Mac OS X developer tools.

So, we're left to fend for ourselves. Or to let others do it and distribute binaries. But these pages are for the do-it-yourselfers.

We mostly have to start from scratch, and use what is provided by Apple when we can. There are a couple options: do it all yourself, or start with a base of one of the few package managers (Fink and Darwinports) or some other library base (Graphics Libs, GIS Libs). These pages show you how to start from scratch, tho they could be easily adapted to using stuff from Fink or Darwinports. Be warned that they can cause headaches that I won't get into, and you are on your own figuring it out.

These instructions assume very little command line knowledge, and try to be explicit and detailed. Be warned, there is a bit of patching to do for a few items. Some, unchanging, items use patch files that you must download, it's easier and reduces error. But most others will be patching instructions, so it's easier to apply it to future versions of the library.

An expanded version of these instructions that includes MapServer in the mix is on my website.

General Requirements

Mac OS X 10.3 (Panther) or 10.4 (Tiger). You should have installed the BSD support with a custom install (it's default now in 10.3). It is recommended to update Panther to 10.3.9 and keep up on security updates. You can use Mac OS X Server if you like, but you should install X11 (it's not a part of a normal Server installation).

Apple's X11 + X11 SDK (for 10.3+, the X11 SDK is included in Xcode). Needed to use the Tcl/Tk GUI and to run NVIZ in GRASS. And for a couple libraries. Tcl/Tk Aqua is mostly supported, but to get full Tcl/Tk support, X11 is best, for now. Here are a few notes on setting up X11.

Apple's Xcode Tools (free membership required) + any updates. Nothing difficult about this installation, but make sure you install the BSD extras (I think it's default now), and the X11 SDK. Also make sure that you use the latest GCC for your version of Mac OS X, GCC 3.3 in 10.3 and GCC 4 in 10.4 - type gcc_select to check, and sudo gcc_select 3.3 or sudo gcc_select 4.0 to change it if needed.

Admin access to your Mac is recommended. But, it is possible to install all this in another location without admin privileges, like your home folder.

A text editor. If you can afford it, BBEdit is your best choice. Their free TextWrangler also works very well. Both have command-line tools to open a file in their applications, and both can easily open invisible (dot) files, and edit administrator-privileged files. Tex-Edit Plus is also a good choice, but it's hard to open invisible files. If you're up to it, you're welcome to the command line editors like pico.

Setup your shell for easy user command access.

Notes on the Command Line (CLI)

In the instructions, everything after the shell prompt until the next prompt should be typed on a single line followed by a <Return>. Text in italics should not be typed literally, but fill in with appropriate text as explained in the intructions or by the label.

Where a command needs a full path to something, you can save a lot of typing by dragging the folder or file from a Finder window to the Terminal. The full path will be inserted where the cursor is. Quotes are not needed around the path in this case, special characters are properly escaped.

Generally, a lot of text scrolls by after starting 'make'. You can usually just ignore this - as long as make doesn't end with an error message (warnings are OK), you can proceed to 'make install' and it should have been successful. For problems in 'configure', the output in the Terminal window often doesn't have enough about why, you should look in the file 'config.log' for more details. REPEAT: look in config.log if there are configure errors.

Everything is installed in /usr/local. This is hidden on Mac systems, but you get easily get to it in the Finder by Go->Go to folder. If you like, you can make a shortcut to this folder in any number of ways, whatever your prefered method is.

When installing in the default /usr/local, you will be asked to sudo some commands, like installing. After entering a sudo'd command it will ask you for an admin password. This is your user password, and you should have admin privileges to your Mac. Just type the password when asked by the Terminal. But do pay attention, nothing here should be dangerous or a security problem, and Macs are known for being virus-free, but it IS possible.

Specific versions are listed, but unless there are major changes, later versions can be used. You just need to make small adjustments in the commands given here for a new version.

Build Steps

Notes: some of these may not be used by GRASS, at least not directly, but are included for maximum flexibility. When updating GRASS or most of the libraries, you don't have to rebuild everything else. Some libraries (MrSID, NetCDF, HDF) require you to rebuild anything that uses them directly (GDAL).

NOTE: Currently r.terraflow does not compile on Tiger. This is a GCC 4 issue and affects other systems as well, and is present in both 6.0 and 6.1 CVS.

  1. giflib/libungif.
  2. libjpeg.
  3. libpng.
  4. libtiff.
  5. libjasper (optional). JPEG2000 library.
  6. libfftw (optional). Used in i.fft, i.ifft modules.
  7. PROJ.4.
  8. libgeotiff.
  9. GEOS (optional). Not directly used by GRASS, but useful.
  10. MrSID Geo DSDK (optional). Used by GDAL to read MrSID data.
  11. OGDI (optional). For reading VPF data (ie VMAP0).
  12. NetCDF (optional). For reading NetCDF data.
  13. HDF (optional). For reading HDF data.
  14. Tcl/Tk.
  15. LessTif (recommended). Used for the xganim module.
  16. PostGreSQL + PostGIS (recommended). Full vector feature support.
  17. GDAL/OGR. Make sure to install with GRASS support to be able to export raster data with GDAL.
  18. GRASS. This is what you've been waiting for! The instructions are for GRASS 6.0.x, but should work just as well for GRASS 6.1 CVS.

Alternative Install

That's a lot of stuff to install, before you even get to GRASS. Much of it could be used from Fink or Darwinports, but they have their own problems. This alternative uses William's (that's me) Mac OS X installer packages for most of the dependencies, and takes care of some complicated configuration stuff for Postgres.

  1. Graphics Libs package. There's an updated expat and freetype in this.
  2. GIS Libs package. Includes some extra formats that didn't make it into the build instructions yet. No MrSID included.
  3. MrSID Geo DSDK (optional). Only for the utilities.
  4. Tcl/Tk.
  5. LessTif (recommended). Used for the xganim module.
  6. PostGreSQL + PostGIS package. You get the bonus of a startupitem so Postgres always starts on bootup.
  7. GRASS. GDAL+GRASS support is included separately in the GIS Libs package, and is not connected with an installed GRASS.

Nothing changes in the Tcl/Tk and LessTif builds since they don't use any of the other dependencies.

Setup and Run

First, before opening a graphic window or using TclTk GRASS, you must start X11 manually. You could add it as a Login item if you like, so it's always available.

To get GRASS to use our X11 version of Tcl/Tk, add the following to your .bash_profile (for bash) or .cshrc (for tcsh):

export GRASS_TCLSH=/usr/X11R6/bin/tclsh
export GRASS_WISH=/usr/X11R6/bin/wish

or:

setenv GRASS_TCLSH /usr/X11R6/bin/tclsh
setenv GRASS_WISH /usr/X11R6/bin/wish
To get GRASS to record errors in an error log file, instead of the default trying to email you: after starting GRASS for the first time, use the g.gisenv: [*** is this still needed? ***]

GRASS 6 > g.gisenv set="GRASS_STDERR=1"

and then:

GRASS 6 > touch ~/GIS_ERROR_LOG
*/ ?>
© 2003-2005 GRASS Development Team
Comments about this page | FAQ | Download | Support | Docs | Programming | Back HOME
Last change: $Date$