Macports' dropping of privileges causing Xcode licence problems - xcode

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.

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.

Related

Fixing brew doctor warnings/errors

I have recently installed Homebrew and RVM. However, when I tried to install a new version of Ruby into RVM:...
rvm install 2.2
I got the following error:
Searching for binary rubies, this might take some time.
Found remote file https://rvm_io.global.ssl.fastly.net/binaries/osx/10.9/x86_64/ruby-2.2.0.tar.bz2
Checking requirements for osx.
ERROR: '/usr/local/bin' is not writable - it is required for Homebrew, try 'brew doctor' to fix it!
Requirements installation failed with status: 1.
So I ran the doctor command to view errors and saw:
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
Warning: /usr/local/bin isn't writable.
This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.
I found the same issue with various other directories:
/Library/Caches/Homebrew
/usr/local/Cellar
/usr/local/etc
/usr/local/include
/usr/local/lib
/usr/local/lib/pkgconfig
/usr/local/opt
/usr/local/share
/usr/local/share/man
/usr/local
When I installed RVM, I did a single user install into a non admin account. This non admin account I will be using as my development account. Is this ok, or should I be developing using an admin account? I am running into all sorts of permissions type issues; eg trying to install a gem, because of write permissions failures and am now questioning what is the proper way to develop code, without being an admin, or should I be an admin?
I was going to start using chown to fix these errors ie
chown $USER -R /usr/local/bin
but, this worries me. Do I want to be changing the owner of all these system directories to my non admin account? Just want some re-assurance really before I go ahead, it just feels, wrong. (PS; is that the correct use of chown?)
I've seen other articles that suggest using sudo, but I've also seen artciles that say you shouldn't use sudo. Err-ing on the side of caution, I would rather not use sudo.
Thanks.
Most of these questions are pretty well covered by the Homebrew FAQ.
Do I want to be changing the owner of all these system directories to my non admin account?
System libraries are not installed to /usr/local. Apple doesn't include that directory on a clean install. Most likely some other installer put things there as root or another user.
I've seen other articles that suggest using sudo, but I've also seen artciles that say you shouldn't use sudo.
Homebrew should not be used with sudo, but it does assume the user is an admin and has rights to /usr/local. If you are just referring to fixing the permissions with chown, that will require sudo (and admin account).

Troubles with installation of Homebrew

I am trying to install Homebrew on a fresh install of OS X Yosemite (removed old partition using disk utility and did a complete re-install, carried over no media, completed about 10 minutes ago).
Unfortunately I have closed terminal since the first time I attempted the install using:
"ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)",
as such I do not have the original error code. I used the install command as provided above, and was directed to install command line tools. This part played out fine. After command line tools installed I hit 'return' as directed, and it began 'installing home-brew'. The installation seemed to stall and then an error message was displayed.
So then I re-attempted the install by simply re running the same terminal prompt and terminal gave me this message:
"Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.",
then this it said that the installation was successful. However, I was then prompted to run brew doctor, to which I then ran and subsequently was alerted with:
"Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
Error: Failure while executing: /usr/bin/otool -L /usr/bin/install_name_tool".
I then used the prompt "brew help" to see if it would work and it did, but again trying to use brew doctor yielded: "Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
Error: Failure while executing: /usr/bin/otool -L /usr/bin/install_name_tool".
I then attempted to use the lines from https://gist.github.com/mxcl/1173223 to uninstall Homebrew. Terminal displayed a message of success. I then quit terminal, re-opened it and typed brew to which I was given a catalogue of options to which I assumed brew was not installed as I had thought.
So, I do not know what went wrong with my installation of Homebrew and if someone could educate me that would help. I would also appreciate information of how to go about uninstalling and then reinstalling Homebrew with success.
Thanks
I just came across same problem (using Yosemite), with same error message. I'm a newbie on this, so I might be doing, but what I tried seemed to be working. I think this is not an installation error, but we just have to agree the license and run via sudo.
Here are the step I took. (It's a bit redundant)
First I did "sudo brew doctor"
Then it said:
You have not agreed to the Xcode license agreements, please run
'xcodebuild -license' (for user-level acceptance) or 'sudo xcodebuild
-license' (for system-wide acceptance) from within a Terminal window to review and agree to the Xcode license agreements.
Error: Failure while executing: /usr/bin/otool -L /usr/bin/install_name_tool
So I did "xcodebuild -license"
Then it said:
Agreeing to the Xcode/iOS license requires admin privileges, please
re-run as root via sudo.
So I did "sudo xcodebuild -license"
Then it said:
You have not agreed to the Xcode license agreements. You must agree to
both license agreements below in order to use Xcode. Hit the Enter key
to view the license agreements at
'/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'
And then I hit enter and the MAC SDK AND XCODE AGREEMENT.
You have to read to the end to actually agree to this. So I kept hitting space to show the entire Agreenent.
At the end, it said
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]
Then I typed "agree" and "brew doctor," it said
Your system is ready to brew.
I hope this helps!
open you xcode tools ,and it will pop up a window to let you agree xcode license and back to term window ,it will work

"sudo xcodebuild -license" fails to cure recurring xcode license prompt

I am attempting to install Homebrew on my new Mac (OS X 10.9.5; XCode ver 6.1), and I keep getting the following error message when I run "brew doctor":
"Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo."
This message repeats several times in my terminal output, and I keep getting prompted to accept the XCode license every time I start up XCode, even though I accept the license each time.
Below is what I see in terminal:
---startOuput---
$ brew doctor
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
Warning: Git could not be found in your PATH.
Homebrew uses Git for several internal functions, and some formulae use Git
checkouts instead of stable tarballs. You may want to install Git:
brew install git
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:
easy_install
easy_install-2.7
Consider setting your PATH so that /usr/local/bin
occurs before /usr/bin. Here is a one-liner:
echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile
Warning: You have not agreed to the Xcode license.
Builds will fail! Agree to the license by opening Xcode.app or running:
xcodebuild -license
---endOuput---
I've done quite a bit of web research, and it seems as if the traditional solution is to do one of two things: (i) open XCode and accept the license via the GUI or (ii) accept the license via the command line with "sudo xcodebuild -license" and follow the prompts to "accept". (See, e.g., Jetbrains; Stackoverflow; GoogleCode)
But the problem is still not resolved. I have accepted the license agreement both via the GUI and the command line by running "sudo xcodebuild -license". I have done these things several times (and quite ad nauseam), but I keep getting told that I haven't accepted the XCode user license. I've also rebooted my computer repeatedly to no avail. What's really strange is that I can't seem to find any threads discussing this unique problem -- i.e., that acceptance of the XCode license agreement doesn't seem to "stick."
This is my first stack overflow post; any help would be much appreciated.
Thank you
I had the same issue — it turned out that /Library/Preferences/ was not readable/writable.
Go to /Library/ and change the Preferences folder permissions for your user to Read & Write.

running brew commands is full of 'Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.'

This affects many other things too but in brew you may see lots of things suggesting:
'Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.'
Brew explicitly recommends you do not run it under sudo.
running brew doctor gave me useful answers to this
Provided software update is closed you may be able to agree to the license by opening Xcode.app, but I couldn't... so instead I ran:
sudo xcodebuild -license
Which if you scroll to the bottom lets you type 'agree' and then you're good to go.

Install Git Client on OS X without admin rights

I need to run a git client on an OS X 10.6.6 machine to which I don't have admin rights.
Now unfortunately, the installer from http://code.google.com/p/git-osx-installer/ has no option for a local install, so it just doesn't work without having an admin account.
What is the fastest / easiest way to install git, e.g. in ~/bin ?
Note: While I can download zip archives from GitHub (from which my projects come), I need to be able to quickly pull new commits, so this is not an option.
Fink has no binary for OS X 10.6, and the MacPorts installer doesn't work either without admin rights.
Download Git source code and compile.
./configure --prefix=$HOME/local
make
make install
Edit .bashrc or whatever to change PATH.
PATH=$HOME/local/bin:$PATH
I'd use homebrew to install git as a local user. That's a whole lot easier to update and gives you the chance to use the whole infrastructure to install even more goodies.
https://github.com/mxcl/homebrew

Resources