Tags: faq matlab mex

MATLAB complains that mexmaci64 cannot be opened because the developer cannot be verified

When you try to use FieldTrip on macOS Catalina or later, you may get an error like

"ft_getopt.mexmaci64" cannot be opened because the developer cannot be verified.
macOS cannot verify that this app is free from malware.

or a similar error for another mex file that is included with FieldTrip.

This problem is due to additional security measures implemented in macOS. MATLAB mex files are small dynamically linked libraries (comparable to .dll files on Windows), that are loaded and linked to the MATLAB executable as soon as you execute the function implemented in the mex file. The problem is discussed in more detail here, which also provides a solution.

If you trust the source where you have downloaded FieldTrip, you can resolve these errors for all mex files at once by opening a terminal and typing

sudo xattr -r -d com.apple.quarantine LOCATION_OF_FIELDTRIP

sudo find LOCATION_OF_FIELDTRIP -name \*.mexmaci64 -exec spctl --add {} \;

where LOCATION_OF_FIELDTRIP is the place where you have unzipped FieldTrip. Following sudo you will have to give your administrator password.

The first command removes all FieldTrip files from quarantaine, the second adds a Gatekeeper exception to all mex files.

Tags: faq matlab mex