MATLAB: “No such file or directory” error when running the “mex -setup” command on a Mac

codedirectoryfilegenerationmatlab codermexnoorsuch

When I run the "mex" command to setup my C compiler, I see very obscure errors in the output. See below:
 
>> mex -setup
*_find: 76282: No such file or directory_*
*_find: 76285: No such file or directory_*
*_find: 76288: No such file or directory_*
*_MEX configured to use 'Xcode with Clang' for C language compilation._*
_*Warning: The MATLAB C and Fortran API has changed to support MATLAB*_
_* variables with more than 2^32-1 elements. You will be required*_
_* to update your code to utilize the new API.*_
_* You can find more information about this at:*_
_* <http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html>.*_
To choose a different language, select one from the following:
mex -setup C++
mex -setup FORTRAN
What is causing these errors? How can I prevent these errors from showing?

Best Answer

Incorrect modifications to the MATLAB path or unintentional corruption of the MATLAB Preferences may be a cause for these errors. To eliminate these errors, use these steps:
1. Regenerate MATLAB Preferences
This is an easy process that involves simply renaming the preference folder that MATLAB references upon startup. The instructions to regenerate MATLAB Preferences can be found here.
2. Restore MATLAB default path by using the following commands:
restoredefaultpath
rehash toolboxcache
If those commands resolve the issue, then execute:
savepath
Related Question