Matlab Errors: License Manager and mexmaci64

Working from home during a pandemic can be exhausting: Choosing what not to wear, what not to pack for lunch; one day, I hope, our descendants will look back at us and appreciate the sacrifices we made. Sure, our great-grandfathers stormed the beaches of Normandy and fought the Kaiser and all that, but they never had to deal with digital eyestrain from back-to-back Zoom meetings - sometimes more than three or four in a row. I’m not asking for a parade here; we were just doing our job.

But if that wasn’t bad enough, some of us also have problems with Matlab connecting to its license server. For those working remotely, you may have come across this particular error message when opening up Matlab:

Matlab License Manager Error -15: Cannot connect to the license server

If you downloaded an academic copy of Matlab through your university - for example, through the Managed Software Center, which is used at several institutions, including the University of Michigan - you will need to be connected through a Virtual Private Network in order for the license to be located. This means you will have to download a program like Cisco AnyConnect, which creates an encrypted connection with another network, as though you are connected to that network directly. (Details about downloading Cisco AnyConnect and configuring it for University of Michigan students and staff can be found here.) Once the VPN is connected, you shouldn’t run into the above error anymore.

Even when this is resolved, however, you may notice another error that looks something like this when trying to run any commands in SPM12, or another toolbox like FieldTrip or the CONN toolbox:

Matlab mexmaci64 cannot be opened because the developer cannot be verified

To fix this problem, open a Terminal by clicking on the magnifying glass icon in the upper-right corner of your screen and typing “Terminal”. Then, type the following line of code:

cd ~
sudo xattr -r -d com.apple.quarantine spm12

In this example, we are trying to remove the mexmaci64 verification errors for SPM12, which is usually located in your home directory (here, represented by a “~” symbol). Running this code will prompt you to enter your password; once you’ve done that, type the following code:

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

This should prevent any more mexmaci64 errors from showing up. To apply this to another toolbox, replace “spm12” in the above lines of code with the name of your toolbox - such as “conn”, which is also usually installed in the home directory.

Note: I found the above code on this page, which I adapted for SPM. I would like to thank FieldTrip for posting this, as I was not able to find the solution anywhere else.