For some reason I can't get MacPorts to install a package, it keeps telling me I don't have prvileges, despite being run via sudo. Any ideas as to why this is? Do I really have to run as root (eg. su - ...etc)? I'd rather not if I don't have to.

Thanks, -- Demis

example failure:

[09:28:37]> sudo port install gwyddion
Warning: MacPorts running without privileges. You may be unable to complete certain actions (e.g. install).
--->  Computing dependencies for gwyddion
--->  Dependencies to be installed: gtk2 atk glib2 ...
   .....................
--->  Activating p5-locale-gettext @1.05_2
Error: Target org.macports.activate returned: can't create directory "/opt/local/lib/perl5/vendor_perl": permission denied
Error: The following dependencies failed to build: gtk2 atk glib2 ...
  ...........
Error: Status 1 encountered during processing.
link|improve this question
Is the account you're trying to use to install packages an Admin account in OS X? In your example, there's no line where sudo asked you for your password. Did you need to type in your password? Also note that sudo will not work if your account has no password. – fideli Sep 6 '10 at 5:22
How about running other commands under sudo? What happens if you try sudo ls? Do you get prompted for the su password? – dtlussier Sep 6 '10 at 17:43
i had run this command earlier, at which point i'd enetered my password. This copy/pasted output didn't ask for the password because the sudo session was still active (it won't ask for the password if I sudo within ~5m or so, or do sudo -k (kill the sudo session)) -- Demis – user48543 Dec 13 '10 at 16:55
feedback

2 Answers

Check the output of

sudo id -p
link|improve this answer
feedback

You pretty much have to sudo every port command; it assumes you've got permission to do anything and many commands will fail if you can't.

I've recently switched from Mac Ports to Brew, which you can find here. It doesn't require any special permissions to install (thus, no sudo), which is nice:

  • installs packages into their own isolated prefix and then symlinks everything into /usr/local
  • self-contained and unintrusive
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.