xcodebuild: error: SDK "macosx10.7" cannot be located.It may be caused by technical incompatibility between Xcode and SPM. To solve this problem, the following customization would be helpful.
Step 1. SPM optionTo let SPM use the correct mex functions, put the full path at the term MEXBIN in the file
MEXBIN = /Applications/MATLAB_R2012a.app/bin/mex
Step 2. MATLAB optionGo to the SDK directory in Xcode to check the SDK version as introduced in this discussion; for example,
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKsThen you would see the files such as "MacOSX10.xx.sdk". Open MATLAB, and execute the following command
mex -setupthen select "1" so that a user-specific options file for building MEX-files named "mexopts.sh" is copied to a specified folder (shown in the command window) from the template option file. Open the file "mexopts.sh", and replace the original version (probably four texts) to updated version verified from the SDK directory; for example "10.7" to "10.9". After saving the file, follow the SPM installation process again. (For additional information, refer to the discussion).