0
votes

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:

  • I have run sudo xcodebuild -license and successfully agreed to the licence however when I run xcodebuild -license I get the same error as above.
  • I am running Macports in sudo: 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.

1

1 Answers

0
votes

License acceptance is stored in

  • /Library/Preferences/com.apple.dt.Xcode.plist,
  • ~/Library/Preferences/com.apple.dt.Xcode.plist (MacPorts copies this file from your home on startup to support older Xcode releases that required per-user acceptance), or
  • ~macports/Library/Preferences/com.apple.dt.Xcode.plist

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.