0

This question already has an answer here:

I deleted "chmod" by mistake using "sudo rm chmod". What is the way to recover the chmod command? Is it 'a no way to do it' operation? I'm using Mac OS X Yosemite.

marked as duplicate by nohillside Jul 19 '15 at 13:03

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

migrated from stackoverflow.com Jul 16 '15 at 18:09

This question came from our site for professional and enthusiast programmers.

  • 1
    There's a recovery partition; you may be able to use that. However, I think the question is more appropriate for Ask Different — or possibly Super User. Also, if you have Time Machine backups running, you should be able to use that to recover a copy of the file, and then carefully use sudo to copy it back to /bin/chmod. And, in future, make sure you are paying attention when you're working as root. Removing a single binary is fairly innocuous compared with the damage you could have done. – Jonathan Leffler Jul 16 '15 at 6:24
  • Thanks to reply. However I didn't have any backups, so i need another way. – Yu Takase Jul 16 '15 at 8:20
1

This question probably has all the answers for you. In short there is no easy way. Your options are:

  1. Recover the files from a (Time machin) Backup, if existent.
  2. Reinstall OSX, e.g. from the Recovery mode pressing Command+R at the startup screen
  3. Copy the missing files from the Recovery partition (check if the partition is up to date first). E.g. by doing cp -a /bin /Volumes/<your disk name>