How to accept Xcode license?

I've been searching the web to look for how to accept Xcode in order to use Xcode to recompile a MATLAB Windows file for a MAC but I did not find any relevant answer. The error message I get in MATLAB is :

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

I have accept its license through the terminal command sudo xcodebuild -license then -q then agree but I still get the same error message. I have also accepted the license when first opening the application. Do someone know how to solve this problem? Xcode : version 6.4 and Matlab R2015a

16.9k 5 5 gold badges 84 84 silver badges 107 107 bronze badges asked Jul 13, 2015 at 13:40 221 1 1 gold badge 2 2 silver badges 4 4 bronze badges

So I assume you are running that from the command line? If so start the Xcode app and accept the license.

Commented Jul 13, 2015 at 13:47

9 Answers 9

You can use the following command to directly accept the license:

sudo xcodebuild -license accept 
answered Sep 26, 2018 at 12:33 Ronan Boiteau Ronan Boiteau 10k 7 7 gold badges 37 37 silver badges 58 58 bronze badges

I get xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance when running this

Commented Apr 30, 2019 at 20:29 Try setting it: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer Commented Aug 27, 2020 at 4:04

If you are using the command line then go through the entire license by entering space until you get to the end where you will be presented with:

By typing 'agree' you are agreeing to the terms of the software license agreements. Type 'print' to print them or anything else to cancel, [agree, print, cancel]

type "agree" and return

Alternatively just launch Xcode by double clicking it's icon and when presented with the license agreement accept it.

Updated for new information:

It seems this may be a MATLAB issue. What version of Xcode are you running? Check with MATLAB to see if that is a supported version.

answered Jul 13, 2015 at 14:02 113k 21 21 gold badges 191 191 silver badges 231 231 bronze badges

If you have only the Command Line Tools installed (and you don't want the full Xcode), none of the above works. From my saver here, run the following to trick mex into seeing an accepted license (no sudo needed). Here I use the current version 13.0 at the time of writing, to be adapted.

defaults write com.apple.dt.Xcode IDEXcodeVersionForAgreedToGMLicense 13.0 
answered Sep 16, 2022 at 8:35 1,190 11 11 silver badges 17 17 bronze badges

This worked for me, thanks for posting! I just want to clarify for future readers that the version number is the version of Xcode, not the license or anything else. But I don't think the version matters to Matlab.

Commented Dec 23, 2022 at 0:05

Simply type the sudo xcodebuild -license into the terminal after press q for quite then type agree

Note: Xcode name should be Xocde not like that Xcode 8.2,etc.,

116k 43 43 gold badges 167 167 silver badges 164 164 bronze badges answered Apr 20, 2017 at 12:19 Ekambaram E Ekambaram E 1,232 1 1 gold badge 12 12 silver badges 10 10 bronze badges I don't have admin access on my macbook. What do I do? – user2891129 Commented Feb 26, 2018 at 16:52

You can also try enabling the command line tools, which should help prevent the license acceptance issue:

# Install Command Line Tools xcode-select --install # Enable command line tools sudo xcode-select --switch /Library/Developer/CommandLineTools 
answered Nov 25, 2018 at 21:07 1,000 1 1 gold badge 10 10 silver badges 17 17 bronze badges

FYI - If you have installed the beta version at some point, deleted it, and then installed the regular version of Xcode, the license file will still be associated with beta version. This is what was happening to me, as I continued to get the warning about not having accepted the license. To fix this issue, you need to delete the Xcode license file and then run the above command in terminal.

Navigate to /Library/Preferences/

Delete the file com.app.dt.Xcode.plist

Then in terminal sudo xcodebuild -license accept

Then in Matlab mex -setup

This worked for me! Note that this method of deleting the plist file was provided to me by the folks at Mathworks support. There had been existing issues related to beta installs of Xcode.

answered Aug 5, 2021 at 16:57 15 4 4 bronze badges

What worked for me was deleting the file: Library/Preferences/com.apple.dt.Xcode.plist and then running 'sudo xcodebuild -license accept' in the terminal.

The first Xcode Licence I agreed to was a beta license. Therefore somehow the entries in this file were still named . beta. what seems to have caused the error. By running 'sudo xcodebuild -license accept' a new file is created that is compatible with Matlab (provided ur not using a beta Xcode Version).

I also downloaded the latest Version of the Command Line Tools but I don't know if that would have been necessary.

Hope I could help.

1,835 1 1 gold badge 17 17 silver badges 28 28 bronze badges answered Apr 18, 2019 at 10:01

This is from 2021, using Mac Big Sur version 11.0.1 with Xcode-beta My problem is that Macports install requires Agree to Xcode license in Terminal: sudo xcodebuild -license but that command returned only xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance. I found a stack overflow issue that mentioned how to reset the xcode-select. which in my case is sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer. Then I used sudo xcodebuild -license, scrolled through the license and accepted it. (Via the application, I never had an option to accept.) the other stack flow issue that helped me is xcode-select active developer directory error

answered Mar 27, 2021 at 3:27 Ruth Berge Ruth Berge 31 5 5 bronze badges

For the non-command line solution, you can either open Xcode and click Agree or alternatively, you can enter sudo xcodebuild -license accept in the terminal.

enter image description here

answered Sep 20, 2023 at 9:32 16.9k 5 5 gold badges 84 84 silver badges 107 107 bronze badges

Linked

Related

Hot Network Questions

Subscribe to RSS

Question feed

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2024 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2024.9.17.15358