MacOS – How to accept Xcode license

gccmacosxcode

I want to install a C based toolbox on MATLAB software. To do this, I need to install the GCC compiler. I think I have done that already. And I have Xcode too.

To setup the toolbox, I need to write mex -setup; in the MATLAB command window. I've got the following warning and don't know how to solve it:

Warning: Xcode is installed, but its license has not been accepted. Run Xcode and accept its license agreement.

Error using mex
No supported compiler or SDK was found. For options, visit http://www.mathworks.com/support/compilers/R2014a/maci64.

Best Answer

In Terminal:

sudo xcodebuild -license

Which should view/accept it on behalf of all accounts on that particular Mac.

In recent Xcode versions you are able to accept it in one step:

sudo xcodebuild -license accept