MATLAB Answers

Magnus
2

Mex on macosx without xcode

Asked by Magnus
on 14 Oct 2016
Latest activity Commented on by Art
on 15 Jan 2019
I want to compile mex files without installing xcode, using only Command Line Tools (from apple developer center).
Apple Command Line Tools install the compiler and adds standard libraries and headers to the system in a package much smaller than xcode (which is several GBs).
Running mex on linux is possible - I see no reason why matlab mex should require the huge SDKs for macos. A long evening of trial and error and hacking configuration files hasn't helped. Does anyone have a minimal working example of how to compile a mex file outside matlab, or a simple way to use mex without having xcode installed?
Best Regards, Magnus

  1 Comment

I figured out a way around it. Open a terminal window and run the following command:
/usr/libexec/PlistBuddy -c 'Add :IDEXcodeVersionForAgreedToGMLicense string 10.0' ~/Library/Preferences/com.apple.dt.Xcode.plist
This creates a property file with an Xcode version number (the value of which probably doesn't matter). You should now be able to use Command Line Tools without installing Xcode.

Sign in to comment.

1 Answer

Answer by Magnus
on 17 Oct 2016

  2 Comments

Pierre
on 27 Sep 2018
The solution above by Martin Andersen is the fastest and more elegant. I confirm it works perfectly.
Art
on 15 Jan 2019
I also had success using the plist trick.

Sign in to comment.