paulguy paulguy - 3 months ago 16
iOS Question

Appcelerator - Xcode EULA has not been accepted. Launch Xcode and accept the license

I am running appcelerator 4.5.0 and xcode 7.2.1 on Mac OS X 10.10.5

Running an iOS app gives me:

[ERROR] : Xcode EULA has not been accepted.
[ERROR] : Launch Xcode and accept the license.


I ran
sudo xcodebuild -license
per: "Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo." when using GCC

But the error persists.

I then (per: https://wiki.appcelerator.org/display/guides2/Uninstalling+Studio) uninstalled appcelerator by deleting:

/Applications/Aptana Studio 3
/Applications/Titanium Studio
/Application/Appcelerator Studio


and then (per https://archive.appcelerator.com/topic/474/how-do-you-uninstall-titanium-and-appcelerator-studio-completely-and-start-from-scratch):

rm -rf ~/.appcelerator
rm -rf ~/.titanium
sudo npm uninstall -g titanium
sudo npm uninstall -g alloy
sudo npm uninstall -g acs
sudo npm uninstall -g appcelerator


and uninstalled xcode with
sudo /Developer/Library/uninstall-devtools --mode=all
per: http://osxdaily.com/2012/02/20/uninstall-xcode/

and I deleted Xcode.app from my Applications folder.

After all that I redownloaded xcode via software update, ran
sudo xcodebuild -license
(typing accept at the end), then installed from the site
Appcelerator_Studio.dmg
and ran
appc setup


But still the error persists.

Any ideas on how to fix?

MORE INFO: After reading https://archive.appcelerator.com/question/155502/using-the-titanium-cli-and-getting-error-you-have-not-agreed-to-the-xcode-license-agreements-please-run-xcodebuild--license I believe I have the same issue (still no resolution though).

Running:

xcodebuild -sdk iphonesimulator
is successful but if I run:

appc titanium build -p ios -T simulator -Y iphone
I get the same errors as above.

UPDATE based on @andre-m comment (referencing http://apple.stackexchange.com/questions/175069/how-to-accept-xcode-license):

I already mentioned that I have run
sudo xcodebuild -license
but I also tried:

sudo xcodebuild -license accept
which gives no output and then I still give the error on the build;

sudo xcode-select -r
no output, error;

sudo xcode-select --install
outputs:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
but still errors;

sudo softwareupdate -l
outputs:
No new software available.
and then still gives the error;

sudo xcrun cc
outputs
clang: error: no input files


UPDATE based on @fokke-appcelerator comment (note these results are the same on both a working and non-working machine):

xcodebuild -checkFirstLaunchStatus; echo $?;
gives
0


sudo xcodebuild -checkFirstLaunchStatus; echo $?;
gives
69


Deleted Xcode.app from Applications (again), reinstalled xcode 7.2.1 -> this time from xcode dmg file How to download Xcode 4 / 5 / 6 / 7 and get the DMG file? (previously via Software Update), opened Xcode and was not given any EULA dialog.

SOLUTION:

Following @fokke-appcelerator's second I logged the exit code, out, and err of https://github.com/appcelerator/titanium_mobile/blob/master/node_modules/ioslib/lib/xcode.js#L333 (which is located here:
/Users/<my_user>/Library/Application Support/Titanium/mobilesdk/osx/5.2.0.GA/node_modules/ioslib/lib
) and got:
xcodebuild: error: invalid option '-checkFirstLaunchStatus'
because that xcode.js script found an older version of Xcode (4.2.6) that was not removed by
sudo /Developer/Library/uninstall-devtools --mode=all
as it should have.

Removing the old version of Xcode and reinstalling the current version of Xcode and then reinstalling the simulators (Launch Xcode; Select Xcode > Preferences; Select the Downloads icon; Click the Install button next to the desired simulator), and reinstalling Appcelerator ...the problem is now solved.

Answer

We check if the EULA has been accepted here: https://github.com/appcelerator/titanium_mobile/blob/master/node_modules/ioslib/lib/xcode.js#L332

Which runs:

xcodebuild -checkFirstLaunchStatus

And then checks the exit code.

Could you run the above command yourself and then echo $? to get the exit code? That should echo 1. If that is true, then unfortunately it seems like your Xcode installation has a problem.

Maybe reinstall Xcode and instead of using the terminal to accept the license, just open Xcode.

Comments