MATLAB: Do I get “No Supported Compiler or SDK was found”

8compilerfoundmacmacosMATLAB Compilernotsierrasupportxcode

In MATLAB R2014a when I run the command "mex -setup" I get the following error:
"Error using MEX no supported compiler or SDK was found."
I have Xcode 8 installed.  Why am I still getting this error?

Best Answer

Versions of MATLAB prior to MATLAB R2016b do not support Xcode 8.x and cannot find it as an installed compiler.  In order to fix this issue you can do the following:
1. Upgrade to MATLAB R2016b (which can find Xcode 8.x as an installed compiler).
2. Install a different version of Xcode.
Xcode does not support downgrading to a previous version, however you can install a different version of Xcode.  Please refer to the following steps to install a supported version of Xcode for your release of MATLAB:
1. Navigate to: <https://developer.apple.com/>
2. Please log in.
The account for this site is separate from your normal Apple account.  If you do not already have an account please create one.
3. Open the downloads page and scroll to the bottom and click "Show More Downloads".
4. On this page you can search and download any version of Xcode previously released.
Once you have Xcode downloaded you can install it side-by-side with Xcode 8.x.  A common method is to rename the install directories from "/Applications/Xcode.app" to "/Applications/Xcode8.0.app" and "/Applications/Xcode7.3.1.app" (where the names vary depending on which versions of Xcode you are installing).
You can choose the default version of Xcode by using the "xcode-select" command.  For example, to select Xcode 7.3.1 as my default version I can use the command "xcode-select -s /Applications/Xcode7.3.1.app" from the Mac Terminal App.