Last change: 2005/8/26
William Kyngesburye <kyngchaos-at-kyngchaos-dot-com>
| Home | Mac GRASS Top | Mac GRASS Build Main | Downloads |
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.
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.
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.
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.
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.
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.
Nothing changes in the Tcl/Tk and LessTif builds since they don't use any of the other dependencies.
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):
setenv GRASS_TCLSH /usr/X11R6/bin/tclsh
setenv GRASS_WISH /usr/X11R6/bin/wish