Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I try to install MacPorts and get this

$ sudo make install
make: getcwd: Permission denied
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
===> making install in doc
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
chdir: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
make: getcwd: Permission denied
/usr/bin/install -c -d -o root -g admin -m 0755 "/opt/local"
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
install: mkdir /opt: Permission denied
make[1]: *** [install] Error 71
make: *** [install] Error 1

I am also not able to

$ sudo mkdir /opt
mkdir: /opt: Permission denied

I can create the directory with

open /

and then with Finder.

I am also able to install MacPorts with the installer .pgk, but then:

sudo port install htop
Error: Insufficient privileges to write to MacPorts install prefix.
share|improve this question
    
It seems that MacPorts has issues with Mavericks. See [this]( apple.stackexchange.com/questions/107092/…) question. Are you migrating or is this a new installation? – napcae Oct 27 '13 at 20:38
    
its a new installation, i compiled on mavericks. – nilo Oct 27 '13 at 21:14
    
Which guide did you follow? Have you installed Xcode or Xcode command line utilities? – napcae Oct 27 '13 at 21:33
    
Guide I have installed xcode 5.01 with command line utilities. I think theres something wrong with permissions. as you can see in my original post, any ideas? – nilo Oct 27 '13 at 21:47
    
please provide the output of ls -l /opt. Did you try to uninstall everything(xcode+command line tools and macports) and then install it again? If you don't need macports specifically, I'd recommend brew. I know, it is not the perfect solution but I assuming it is a bug of MacPorts(seeing the rising questions from other users) and you are not able to do anything right now. – napcae Oct 27 '13 at 21:59
up vote 1 down vote accepted

Well, try the following:
Reboot into single user mode, this is archieved by holding down alt(option) + s while rebooting.
At the prompt /sbin/fsck -fy(careful, QWERTZ-Layout), after that type /sbin/mount -wu. Now /bin/chmod 1775 /. At last /bin/sync,then exit.

This will check your filesystem integrity and correct permissions for your root directory.

share|improve this answer

Check that root's UID is actually 0 on your system: sudo id -u should print 0.

This wasn't the case on my system after updating to Mavericks. If it isn't, you can do the following to fix it:

  • boot into single user mode
  • change to /private/var/db/dslocal/nodes/Default/users
  • check that root's UID is wrong in root.plist using plutil -p root.plist
  • if it is wrong, start by making a backup: cp root.plist root.plist.orig
  • convert the plist to xml format using plutil -fmt xml1 root.plist
  • use your favorite editor to change the number after <key>uid</key> to 0
  • convert the plist back to binary format using plutil -fmt binary1 root.plist
share|improve this answer

The UID of root on your system was: 217 _krbtgt (Kerberos Ticket Granting Ticket)

There IS a user called _krbtgt (Kerberos Ticket Granting Ticket) in /System/Library/DirectoryServices/DefaultLocalDB/Default/users, that indeed is user 217.

More information: https://discussions.apple.com/message/24414669#24414669

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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