0

I had some issues with my Macbook, and I used Time Machine to recover a version of usr/bin. Unfortunately, somewhere along the process, usr/bin/sudo was removed.

Now, even if I want to recover usr/bin/sudo from a past backup, I won't have permission to write to user/bin.

How can I fix problem? I already spent a day trying to fix it.

Update:

I only have issue with usr/bin/sudo. I even have recovered version of it in another directory. I just can't write to usr/bin because I don't have right to write. So I hope I can restart my Mac in some special mode to be able to write to this directory.

  • Any information you can give regarding what was changed using Time Machine would be helpful. For example, was /usr/bin/sudo moved or renamed at some point or was it just deleted? – Joel Taylor Oct 2 '13 at 19:28
  • @JoelTaylor: does it matter? the sudo-binary is disfunctional, OP wants it back. – akira Oct 2 '13 at 19:30
  • If adamYNC, at some point, followed a process similar to forums.macrumors.com/showthread.php?t=1625829 /usr/bin/sudo could be somewhere else and it would just be a matter of executing the renamed binary. – Joel Taylor Oct 2 '13 at 19:33
  • If you don't have sudo you might still be able to start a new shell as root, like su bash. – Der Hochstapler Oct 2 '13 at 19:51
  • @OliverSalzburg That won't work unfortunately.. you'd have to use sudo su. Using su alone is not possible as there's no root account. – slhck Oct 2 '13 at 19:54
2

Reinstall the system. Sure, it's time-consuming, but it would take less time than you've already spent.

If it's not a MacBook Air and If you have another Mac (which is also not a Macbook Air) and a Firewire cable to link them, you could start it up in target disk mode and work on it from another machine. If you don't have those things, see above - The advice was offered based on a good deal of pragmatic practical experience...you can easily spend more time getting all that together than you'd spend reinstalling.

  • I've voted this up because it's a good enough answer, but it also reminds me that one can boot off a DVD or recovery partition, which may contain a valid version of sudo that can be copied over. – user3463 Oct 2 '13 at 21:58
  • 1
    Given that /usr/bin was already corrupted or had things deleted enough to need recovery, and then that went "mysteriously wrong" and ate sudo, wholesale is not a bad option, IMHO. – Ecnerwal Oct 3 '13 at 1:49
1

Can't you just use Finder to copy the sudo binary from a backup? It should keep the owner as root, and authenticating as a superuser in Finder does not require /usr/bin/sudo to exist.

If others who get here from seach engines don't have a sudo binary, you can download an OS X installer application from App Store and use Pacifist to extract the binary. Doing an upgrade install of OS X or upgrading to a new major version of OS X also restores files like /usr/bin/sudo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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