# SPM/Installation on 64bit 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

Mac Intel with 64bit MATLAB is a supported SPM12 platform. Precompiled MEX files (*.mexmaci64) are included in the SPM distribution.

### Installation

Download spm12.zip and its updates spm12_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, you need to have Apple's development environment Xcode installed.
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
Then, in a Terminal, from the src folder of your SPM12 installation, type:
If you get errors such as Bad : modifier in $ (/), this is because the instructions are given for a bash Terminal while you are using a tcsh Terminal. The equivalent commands are:
If you get errors such as xcrun: error: SDK "macosx10.14.1" cannot be located while compiling, execute the following:

## SPM8

Mac Intel with 64bit MATLAB (available since R2009b) is a supported SPM8 platform. Precompiled MEX files (*.mexmaci64) 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, you need to have Apple's development environment Xcode installed. It should be available on your Mac OS X installation DVD.
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
Then, in a Terminal, from the src folder of your SPM8 installation, type:
If you get errors such as Bad : modifier in $ (/), this is because the instructions are given for a bash Terminal while you are using a tcsh Terminal. The equivalent commands are:

## SPM5

Precompiled MEX files for Mac Intel with 64bit MATLAB (*.mexmaci64) are available in the latest update.

### 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

There are no plans to provide SPM2 64bit MEX files for Mac Intel.

## Troubleshooting
### macOS Catalina, Big Sur, Monterey, Ventura

If you have issues with MEX files on macOS (""*.mexmaci64" cannot be opened because the developer cannot be verified. macOS cannot verify that this app is free from malware" or "Code signature not valid for use in process using Library Validation: library load disallowed by system policy"), open a Terminal, cd to the SPM directory and type:
If It doesn't work, please try this equivalent alternative, replacing SPM_PATH with the path of your SPM installation:

### Java Exception and abrupt exit on Mac OS X version 10.10 Yosemite

If you get MATLAB issues with Yosemite, see the following bug report for a patch:

### "This is pdfTeX, Version ..." error

If you get an error message such as:
this is due to a conflict between MATLAB mex and a LaTeX command with the same name. Edit src/Makefile.var and mention the full path when referring to MEXBIN
or change PATH accordingly.

### Slowdown when using graphical inputs

This seems to happen when a window manager for macOS is installed ( Magnet orTiles), see this.