Matlab 2012a Mex works with Xcode 4.5 on Mountain Lion

I have Mountain Lion installed with Xcode 4.5 and Matlab 2012a. I installed and ran the patch that ships on the MathWorks website, but still got the following error:

/Applications/MATLAB_R2012a.app/bin/mex: line 305: llvm-gcc-4.2: command not found
/Applications/MATLAB_R2012a.app/bin/mex: line 1326: llvm-gcc-4.2: command not found

mex: compile of ' "hello.c"' failed.
Error using mex (line 206)

Is there a known solution for this?

Solution: Open Xcode β†’ Settings β†’ Downloads β†’ Install β€œCommand Line Tools”

MathWorks patch is still needed. Resolved issue for me.

+4
source share
1 answer

You do not need to install Xcode. I installed the command line tools and then edited the file "/Applications/MATLAB_R2012a.app/bin/mexopts.sh" and

changed CC from gcc-4.2 to llvm-gcc-4.2

changed CXX from gcc-4.2 to llvm-g ++ - 4.2

SDKROOT '/'

. "mex -setup" MATLAB

(Mac OSX 10.8.2, - 2012, MATLAB 2012a)

+6

All Articles