5

Guys yesterday i asked my brother to delete python 2.7 and install python 3.5 but rather than delete parts of python, he deleted all /usr/local/bin and /usr/bin.

At this point /usr/bin is empty and /usr/local/bin just has the python files that i downloaded today. Terminal is not working (e.g. i can't even clear ,it says command not found.

And btw he told me about 2 files called 'IDLE' and 'BuildApplet' we can't delete them what's about that files i know they were in the python 2.7.

I'm not sure what to do to fix things up - can I undelete or recover these specific files?

4
  • I'm going to edit this. If you only deleted /usr/local then that's a trivial remedy. If you deleted /usr/bin and were successful - the core OS is compromised and trying to use shell commands will likely cause collateral damage. This is really about how recent is your backup and are you able to reinstall the os.
    – bmike
    Jul 30, 2016 at 16:46
  • I have to ask: Why on earth would you want to mess up with /usr/bin or /usr/local/bin in the first place?
    – Barranka
    Aug 1, 2016 at 4:48
  • Linking to our canonical answer on this apple.stackexchange.com/questions/116611/…
    – bmike
    Apr 12, 2017 at 9:55
  • 1
    Possible duplicate of How can I get back a system file after deleting it from my Mac?
    – mmmmmm
    Jun 4, 2019 at 21:26

1 Answer 1

18

/usr/bin is where most of the Terminal commands are stored (e.g. clear). When your brother deletes everything in /usr/bin, he basically deletes most of the executable files that the Terminal and the system use. So the only way to get them back is to reinstall the OS. To do that, boot into recovery mode by holding cmd+r during startup, then after it boots up, select Reinstall OS X and follow the steps to reinstall OS X. It will not erase all of the files that you have. It only writes some system files (all the files in /usr/bin for example) back to where they belong.

7
  • 8
    Also, after reinstalling you should not delete Python 2.7 or any other parts of the standard software. Install Python 3.5 in /usr/local/bin and leave /usr/bin alone. Python 2 and 3 are somewhat different languages, and if any of the OS scripts written for python 2 try to run under Python 3, they may break (and thus random parts of the OS will stop working). Jul 30, 2016 at 15:32
  • what happens if i don't? do i get any errors or something while i am just using my computer or i just can't use terminal?
    – John
    Jul 30, 2016 at 15:33
  • 1
    @Adam I can't say that it won't work without these, but many apps make use of these system processes to function. So it is definitely worth doing the reinstallation.
    – Tom Shen
    Jul 30, 2016 at 15:35
  • Can't i just find these files , download and put where they were?
    – John
    Jul 30, 2016 at 15:36
  • @Adam Yes definitely, but there are tons of files in /usr/bin (on my Mac there are about 1000 files) so it will be very hard to do, and I believe that some of the files are private to Apple which means the only way you can get them is from the OS itself.
    – Tom Shen
    Jul 30, 2016 at 15:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .