Matlab 2020b does not find Xcode Mac OS Big Sur

69 views (last 30 days)
Hi all,
Yesterday I have updated my Mac to the new Mac OS Big Sur, I have installed Xcode 12.2, have installed the X code command line, have accepted the licenses using sudo xcodebuild -license accept, but when I open Matlab and try to install a toolbox I make use for analysis of materials (MTEX - https://mtex-toolbox.github.io), Matlab tries to compile some files, but keeps complaining that Xcode is installed but its license has not been accepted. The full list of errors is below:
>> startup_mtex
I found another version of MTEX and remove it from the current search path!
initialize MTEX 5.5.0 ....
--------------------------------------------------------------------------------
Checking mex files failed!
> Trying now to recompile mex files.
... compiling S1Grid_find.c
Warning: Xcode is installed, but its license has not been accepted. Run Xcode and accept its license agreement.
> In mex_install (line 18)
In check_installation>check_mex (line 75)
In check_installation (line 39)
In startup_mtex (line 70)
Compiling /Users/lfgmorales/Documents/MATLAB/mtex-5.5.0/mex/S1Grid_find.c failed!
... compiling S1Grid_find_region.c
Warning: Xcode is installed, but its license has not been accepted. Run Xcode and accept its license agreement.
> In mex_install (line 18)
In check_installation>check_mex (line 75)
In check_installation (line 39)
In startup_mtex (line 70)
Compiling /Users/lfgmorales/Documents/MATLAB/mtex-5.5.0/mex/S1Grid_find_region.c failed!
... compiling S2Grid_find.c
Warning: Xcode is installed, but its license has not been accepted. Run Xcode and accept its license agreement.
> In mex_install (line 18)
In check_installation>check_mex (line 75)
In check_installation (line 39)
In startup_mtex (line 70)
Compiling /Users/lfgmorales/Documents/MATLAB/mtex-5.5.0/mex/S2Grid_find.c failed!
... compiling S2Grid_find_region.c
Warning: Xcode is installed, but its license has not been accepted. Run Xcode and accept its license agreement.
> In mex_install (line 18)
In check_installation>check_mex (line 75)
In check_installation (line 39)
In startup_mtex (line 70)
Compiling /Users/lfgmorales/Documents/MATLAB/mtex-5.5.0/mex/S2Grid_find_region.c failed!
... compiling SO3Grid_dist_region.c
Warning: Xcode is installed, but its license has not been accepted. Run Xcode and accept its license agreement.
> In mex_install (line 18)
In check_installation>check_mex (line 75)
In check_installation (line 39)
In startup_mtex (line 70)
Compiling /Users/lfgmorales/Documents/MATLAB/mtex-5.5.0/mex/SO3Grid_dist_region.c failed!
... compiling SO3Grid_find.c
Warning: Xcode is installed, but its license has not been accepted. Run Xcode and accept its license agreement.
> In mex_install (line 18)
In check_installation>check_mex (line 75)
In check_installation (line 39)
In startup_mtex (line 70)
Compiling /Users/lfgmorales/Documents/MATLAB/mtex-5.5.0/mex/SO3Grid_find.c failed!
... compiling SO3Grid_find_region.c
Warning: Xcode is installed, but its license has not been accepted. Run Xcode and accept its license agreement.
> In mex_install (line 18)
In check_installation>check_mex (line 75)
In check_installation (line 39)
In startup_mtex (line 70)
Compiling /Users/lfgmorales/Documents/MATLAB/mtex-5.5.0/mex/SO3Grid_find_region.c failed!
... compiling insidepoly_dblengine.c
Warning: Xcode is installed, but its license has not been accepted. Run Xcode and accept its license agreement.
> In mex_install (line 18)
In check_installation>check_mex (line 75)
In check_installation (line 39)
In startup_mtex (line 70)
Compiling /Users/lfgmorales/Documents/MATLAB/mtex-5.5.0/mex/insidepoly_dblengine.c failed!
... compiling insidepoly_sglengine.c
Warning: Xcode is installed, but its license has not been accepted. Run Xcode and accept its license agreement.
> In mex_install (line 18)
In check_installation>check_mex (line 75)
In check_installation (line 39)
In startup_mtex (line 70)
Compiling /Users/lfgmorales/Documents/MATLAB/mtex-5.5.0/mex/insidepoly_sglengine.c failed!
********************************************************************************
MTEX: Couldn't get the mex files working!
The original error message was:
Invalid MEX-file '/Users/lfgmorales/Documents/MATLAB/mtex-5.5.0/mex/SO3Grid_dist_region.mexmaci64': dlopen(/Users/lfgmorales/Documents/MATLAB/mtex-5.5.0/mex/SO3Grid_dist_region.mexmaci64, 6): Library not loaded: @loader_path/libmex.dylib
Referenced from: /Users/lfgmorales/Documents/MATLAB/mtex-5.5.0/mex/SO3Grid_dist_region.mexmaci64
Reason: image not found
Please have a look at https://mtex-toolbox.github.io/installation
or ask in the forum https://groups.google.com/forum/#!forum/mtexmail for help.
********************************************************************************
If I do mex -setup, it returns:
Warning: Xcode is installed, but its license has not been accepted. Run Xcode and accept its license agreement.
Error using mex
No supported compiler was found. For options, visit https://www.mathworks.com/support/compilers.
Does anyone know how to solve that, I know this is not specific for this toolbox, but a compiler issue?
thanks a lot
Luiz

Answers (3)

Mario A
Mario A on 29 Jun 2022
Edited: Mario A on 29 Jun 2022
MATLAB requires Xcode to build MEX files on macOS: if only the Command Line Tools are available, MATLAB complains that "Xcode is installed, but its license has not been accepted."
To build MEX files with only the Command Line Tools installed, open Terminal and execute the following command to create a property list:
defaults write com.apple.dt.Xcode IDEXcodeVersionForAgreedToGMLicense 12.4
(Replace 12.4 by your version of Xcode)
You should now be able to use mex and mex -setup without MATLAB issuing Xcode-related complaints.
  1 Comment
McBola
McBola on 17 Feb 2023
Thanks, this fixed my very vexing problem. Other attempts at accepting the license were accepted by the OS (Catalina) but did not solve the matlab problem (e.g., sudo xcodebuild -license accept)

Sign in to comment.


Steven Lord
Steven Lord on 26 Nov 2020
I would try following the instruction in the warning message. Run Xcode (outside of MATLAB) and when it prompts you to accept the license agreement, read and accept it. Then run the code in MATLAB again.
  1 Comment
Luiz Morales
Luiz Morales on 29 Nov 2020
Hi Steve, thanks for taking the time to answer, but I am afraid I don’t understand wjat you mean. I already accept the Xcode license, so if I open Xcode by itself, there is nothing to accept, I have accepted the license via terminal as described above. But maybe I am missing something trivial here?

Sign in to comment.


Rameez Wajid
Rameez Wajid on 2 Dec 2020
Release 2020b does not support Xcode 12.x yet ... https://www.mathworks.com/support/requirements/supported-compilers.html

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!