Mex on macosx without xcode

42 ビュー (過去 30 日間)
Magnus
Magnus 2016 年 10 月 14 日
回答済み: Ian 2022 年 1 月 7 日
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
  2 件のコメント
Martin Andersen
Martin Andersen 2018 年 9 月 20 日
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.
Alek Pikl
Alek Pikl 2020 年 11 月 4 日
編集済み: Alek Pikl 2020 年 11 月 4 日
This fixed it for me.
My problem was running mex on a macbook without having to install the full Xcode.
Running
mex -setup
returned an error somewhat in the lines of xcode licence not accepted .
I installed CL Tools but couldn't accept the licence by using
sudo xcodebuild -license
due to some error that CL Tools are not Xcode...

サインインしてコメントする。

回答 (2 件)

Magnus
Magnus 2016 年 10 月 17 日
  3 件のコメント
Art
Art 2019 年 1 月 15 日
I also had success using the plist trick.
Roy Goodman
Roy Goodman 2021 年 9 月 24 日
@Magnus can you share the XML file that you created in Option 2 of your stackexchange answer? I tried to modify it myself, but didn't know what I was doing and got an error when I tried to run mex.

サインインしてコメントする。


Ian
Ian 2022 年 1 月 7 日
There is another solution that works with 2021b: https://stackoverflow.com/a/41538477/415013 — I do not have enough space to install XCode and command-line tools can compile mex files so this solution works well! Mathworks should make it easier to use the command-line tools rather than require the massive XCode install...

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by