# SPM/Installation on Mac OS (Intel)
## Preamble

If you use drag-and-drop in Finder to install the updates, it will actually perform a folder copy and not a folder merge so that updated files will be overwritten but unchanged old files will be deleted (see this thread). Using the command line option as described below will overcome this.

## SPM12

SPM12 is not officially supported on Mac Intel with 32 bit MATLAB, as this platform is about to be phased out (see MATLAB Platform Roadmap). This means that precompiled MEX files (*.mexmaci) are not included in the SPM distribution.
You should be able to compile the MEX files yourself provided you edit spm12/src/Makefile.var so that it uses mexmaci instead of mexmaci64 in the MacOS section.

## SPM8

Mac Intel with 32 bit MATLAB is a supported SPM8 platform. Precompiled MEX files (*.mexmaci) are included in the SPM distribution.

### Installation

Download spm8.zip and its updates spm8_updates_rxxxx.zip in your home directory then type the following in a Terminal:
Start MATLAB and add SPM into your path, either using File > Set Path > Add Folder... or typing
in MATLAB's workspace.

### Compilation

Should you want to compile SPM MEX files (this can currently happen if you are using Mac OS X 10.4 (Tiger)), there are two requirements:
* you need to have Apple's development environment Xcode installed. It should be available on the "Mac OS X Install" DVD that came with your Mac. Navigate to "Optional Installs" and then to "Xcode Tools" and double click the "Xcode Tools" package to install. You will know that you need to install this tool if make is a command not found later on.
* You also need to have the mex executable in your system path. To do so, type the following in a Terminal:
with the appropriate path where MATLAB is installed. The exact syntax might be different if you are using another shell.
Then, in a Terminal, from the src folder of your SPM8 installation, type:
Note: when compiling with Mac OS X 10.5 and wanting to keep compatibility with Mac OS X 10.4, it is advised to set the preprocessor macro:
See Apple Development:Symbol Variants

## SPM5

Precompiled MEX files for Mac Intel with 32bit MATLAB (*.mexmaci) are included in the SPM distribution.

### Installation

Download spm5.zip in your home directory then type the following in a Terminal:
Start MATLAB and add SPM into your path, either using File > Set Path > Add Folder... or typing
in MATLAB's workspace.

### Compilation

If you want to compile SPM5 MEX files by yourself, you need to have Xcode installed and mex in your system path (see SPM8 for details).
Then, in a Terminal, from the src folder of your SPM5 installation, type:

## SPM2
### Installation

Follow the default installation for a UNIX system.
Precompiled MEX files for Mac Intel with 32bit MATLAB (*.mexmaci) are available as an extra package:
* ftp://ftp.fil.ion.ucl.ac.uk/spm/spm2_updates/SPM2_MAC_INTEL_MEX.zip
To run SPM2 on an Intel Mac, you will need to make a few changes to the spm_platform.m file. These are relatively straightforward and have to do with Intel Macs identifying themselves as MACI (instead of MAC) as well as the big vs. little Endian issue.
First, add MACI to the list of platform definitions. In the spm_platform.m file you will see a list that looks like this:
Simply add a line like this:
Finally, at the bottom of the spm_platform.m file you need to add MACI in the list of supported platforms:

### Compilation

If you want to compile the MEX files by yourself, download an updated Makefile and spm_platforms.m file from:
* http://web.me.com/markusnowak/SPM2_on_Intel_Macs
and follow the instructions given there (they have been updated for Snow Leopard).