# SPM/Installation on 64bit Windows
## Preamble

Installing SPM on Windows 64 bit (XP, Vista, 7, 8, 10) should be straightforward. There are pitfalls common to all versions of SPM:
* It is not recommended to install SPM in MATLAB's toolbox folder as MATLAB toolbox directories can be cached and changes in SPM files (such as updates) might not appear when using SPM. See Toolbox Path Caching and rehash
* If you get errors regarding "gui_mainfcn", you have to reset your MATLAB path (probably following an installation of a new MATLAB release), use the button "Default" in File > Set Path. See also restoredefaultpath.
* If you use WinZip to unpack SPM's *.tar.gz archives, make sure to uncheck "Tar file smart CR/LF conversion", which is under the "miscellaneous" tab in "configuration" under "options", as it could corrupt some of SPM files otherwise. 7-Zip is a good open source software alternative.
* If you see garbled text or incorrect characters in the interface, you have to change your system locale so that it matches your user locale. This is documented here. See How the MATLAB process uses locale settings and Setting locale for how to fix it. If problems persist, try the instructions detailed at the end of this page.
* If you have an error "Where is spm_check_version.m?", make sure not to start SPM when your MATLAB current directory is C:\Windows\system32 and not to have this directory in your MATLAB path. See MathWorks support.

## SPM12
### Installation

* Download spm12.zip.
* Unzip spm12.zip in a folder of your choice, such as C:\Users\login\Documents\MATLAB\spm12).
* Start MATLAB and add SPM into your path, either using File > Set Path > Add Folder... or typing
in MATLAB's workspace.
* Launch SPM by typing

### Update

If you have just downloaded the spm12.zip archive, it already contains the latest set of updates. To update SPM when a new version is released:
* Download spm12_updates_rxxxx.zip
* Unzip spm12_updates_rxxxx.zip on top of the folder containing your SPM installation so that newer files overwrite existing files.
Alternatively, you can use the spm_update.m function:
If a new version is available, it can be applied to your local installation by typing:

### Compilation

Precompiled MEX files (*.mexw64) are provided with SPM12 and you shouldn't need to recompile them by yourself.
See Compilation of SPM12 MEX files on Windows if needed.

## SPM8
### Installation

* Download spm8.zip.
* Unzip spm8.zip in a folder of your choice, such as C:\Users\login\Documents\MATLAB\spm8).
* Start MATLAB and add SPM into your path, either using File > Set Path > Add Folder... or typing
in MATLAB's workspace.
* Launch SPM by typing

### Update

If you have just downloaded the spm8.zip archive, it already contains the latest set of updates. To update SPM when a new version is released:
* Download spm8_updates_rxxxx.zip
* Unzip spm8_updates_rxxxx.zip on top of the folder containing your SPM installation so that newer files overwrite existing files.
Alternatively, you can use the spm_update.m function:
If a new version is available, it can be applied to your local installation by typing:

### Compilation

Precompiled MEX files (*.mexw64) are provided with SPM8 and you shouldn't need to recompile them by yourself.
See Compilation of SPM8 MEX files on Windows if needed.

## SPM5
### Installation

* Download spm5.zip.
* Unzip spm5.zip in a folder of your choice, such as C:\spm\spm5).
* Start MATLAB and add SPM into your path, either using File > Set Path > Add Folder... or typing
in MATLAB's workspace.
* Launch SPM by typing

### Compilation

Precompiled MEX files (*.mexw64) are provided with SPM5 and you shouldn't need to recompile them by yourself.

## SPM2

SPM2 is not available on Windows 64 bit.

## Troubleshooting

If text still appears garbled in the interface after changing the system locale, try the following:
Edit spm/matlabbatch/private/cfg_mlbatch_defaults.m and modify lines: