Error compiling SPM12 for MATLAB on a Mac M1 with Big Sur

2.5k views Asked by At

I have some problems, trying to install SPM12 on my Mac M1 with Big Sur. My config is:

  • Mac M1 Big Sur (11.3.1) - 512/16GB
  • MATLAB_R2020a
  • SPM12

I followed the instruction here

  1. On Matlab: addpath ./Downloads/spm12/; savepath
  2. On Terminal: export PATH=/Applications/MATLAB_R2020a.app/bin:$PATH
  3. On Terminal (for allowing mex file): sudo xattr -r -d com.apple.quarantine ./Downloads/spm12/
  4. On Terminal sudo find ./Downloads/spm12/ -name \*.mexmaci64 -exec spctl --add {} \;
  5. On Terminal (spm12/src): make distclean
  6. On Terminal (spm12/src): make && make install and it crashes there:
mc@MCs-MacBook-Air src % make && make install
_____________________________________________________________

         MacOS compilation (Intel 64 bit)
_____________________________________________________________

mex -O -largeArrayDims -c spm_vol_utils.c -DSPM_UNSIGNED_CHAR 

    Sorry! We could not determine the machine architecture
           for your host. Please contact:

               MathWorks Technical Support

           for further assistance.

/Applications/MATLAB_R2020a.app/bin/mex: line 295: cleanup: command not found
make: *** [utils_uchar.mexmaci64.o] Error 1

How can I get SPM12 to build?

1

There are 1 answers

0
Maxime Carriere On

Got it! So as you said I shouldn't have done the compilation. As I am with Big Sure I only needed to do:

sudo xattr -r -d com.apple.quarantine SPM_PATH
sudo find SPM_PATH -name \*.mexmaci64 -exec spctl --add {} \;

Thanks for your help ;)