How to accept Xcode license?
Asked Answered
B

9

21

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

Birthday answered 13/7, 2015 at 13:40 Comment(1)
So I assume you are running that from the command line? If so start the Xcode app and accept the license.Snowstorm
F
25

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

sudo xcodebuild -license accept
Fragrance answered 26/9, 2018 at 12:33 Comment(2)
I get xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance when running thisSolvable
Try setting it: sudo xcode-select -s /Applications/Xcode.app/Contents/DeveloperNimbus
M
5

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.

Maggiore answered 13/7, 2015 at 14:2 Comment(0)
S
5

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
Somatotype answered 16/9, 2022 at 8:35 Comment(1)
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.Diantha
P
4

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.,

Pechora answered 20/4, 2017 at 12:19 Comment(1)
I don't have admin access on my macbook. What do I do?Biometrics
H
1

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

Source: https://github.com/nodejs/node-gyp/issues/569

Hexahedron answered 25/11, 2018 at 21:7 Comment(0)
H
1

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.

Human answered 5/8, 2021 at 16:57 Comment(0)
C
0

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.

Cyrie answered 18/4, 2019 at 10:1 Comment(0)
S
0

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

Sugarplum answered 27/3, 2021 at 3:27 Comment(0)
A
0

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

Avrom answered 20/9, 2023 at 9:32 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.