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.

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
  • 1
    Running xcodebuild -license from the command line (without sudo) yields the error Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo., so I think the sudo is needed. – D.W. Dec 23 '15 at 0:24
  • 6
    In recent XCode versions you can also use sudo xcodebuild -license accept to avoid manual input. – Ohad Schneider Feb 2 '16 at 13:04
  • 2
    @OhadSchneider Thanks for the tip. I wonder exactly what purpose this serves, legally.. Not that people actually read the ToS, but XCode having something where you can set up a script to blindly accept a legal agreement makes it feel like it'd be hard to actually enforce the terms in court. – Andrew Theken Mar 25 '16 at 12:57
  • this should be accepted answer. – alex gray Sep 23 '16 at 13:32
  • 1
    So the answer to the above thing since there's a stack overflow bug that prevents me from editing it is that Xcode -license accept doesn't send out any network packets but instead modifies a file on disk. You may need to go to developer.apple.com/account and accept it there instead. Then you'll need to restart Xcode since it can't figure this side channel solution. This bug-filled dance would be hilarious if it didn't take me over an hour to figure it out. – kristopolous Oct 11 '16 at 21:39

You need to start/open Xcode once to accept the license agreement. Easiest way to run the application is by clicking on the Spotlight icon on top right and just type its name.

  • 1
    I've opened it already. But I didn't ask me anything. :( I also, created a project too. @patrix – Electricman Mar 2 '15 at 16:30
  • 1
    @Electricman If you open terminal and type these two commands what are your results? sudo xcode-select -r and sudo xcode-select --install (and if it says you should run Software Update, check there are no Xcode pending updates with sudo softwareupdate -l – bmike Mar 2 '15 at 16:41
  • I wrote sudo xcode-select -r and sudo xcode-select --install and a window has been appeared saying the xcode selected command requires the command line developer tools. would u like to install the tools now with three button including, not now, get xcode and install. So, I selected install Xcode and accepted the licence, and then another boxed opened finding software that says cant install the software be it is not currently available from the software update server. what should I do? @bmike Also, sudo softwareupdate -l shows nothing about xcode needs for updates – Electricman Mar 2 '15 at 16:52
  • 1
    @Electricman Odd - is this computer managed by a corporate IT department? Is your log in user an Admin user? If so, I'd make a new admin test account and re-run the Xcode commands - it could be simply your user or permissions are wonky. Hard to tell without sitting at that computer. The commands should get you all the permissions you need. Worst case, install all the updates and try again with the new user. – bmike Mar 2 '15 at 17:04
  • It is a Admin user. I made a new admin account but got a different error too. very bad situation @bmike – Electricman Mar 2 '15 at 17:27

You can also do this from the command line sudo xcrun cc

If you don't have XCode installed, you can download it from Apple Developer or the App Store.

I had to do the Clover-Space, type xcode (Which pulled up XCode-Beta), and press Clover-Enter to open the file location. I found that my XCode was still in the "Downloads" folder.

So I drag/dropped it onto the Applications folder, then I ran: Download Xcode or move it to your Applications folder. Then, open terminal and run both of these commands. One after the other.

sudo xcode-select -s /Applications/Xcode-Beta.app/Contents/Developer

sudo xcodebuild -license

Then space-down to the bottom and type "agree"

  • bret7600, if you want to answer with your answer, create a new answer. You completely removed the whole point of my answer. If you want to edit somebody's answer, add clarity. Don't rewrite the whole thing. – Suamere Oct 25 '16 at 13:11
  • I'm assuming [Apple Developer][1] is supposed to be a link? – tubedogg Oct 25 '16 at 21:21
  • @tubedogg Thanks, must have gotten cut off in the edit. – Suamere Oct 25 '16 at 21:28

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.