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.
答案1
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.
答案2
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
.