I am trying to install some ports using Macports on OS X but as soon as the installation tries to invoke the C compiler I get:
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
Context:
sudo xcodebuild -license
and successfully agreed to the
licence however when I run xcodebuild -license
I get the same error
as above. sudo port install ghostscript
but
Macports seems to drop the privileges during the installation. (Also tried using the terminal as root user but that didn't seem to help either.)Therefore, I am seeing two options: either managing to somehow agree to the licence at my user level, or forcing Macports to retain the privileges. But so far didn't manage to do any of these.
License acceptance is stored in
Try moving these files aside if they exist and re-do the license acceptance using sudo xcodebuild -license
. Try also cleaning out /var/folders/zz
, the Xcode command line tools use this to cache some data that may cause this problem. If that doesn't help, check file permissions on these files (at least the first one should be -rw-r--r--
, i.e. readable by everyone).
There is a way to make MacPorts build as root rather than dropping privileges, but you shouldn't do that unless absolutely necessary. The privilege separation is a safety feature to avoid misbehaving ports from wreaking havoc on your system.