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?

bmike
  • 235,889
John
  • 55

1 Answers1

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.

Tom Shen
  • 3,317
  • 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). – Gordon Davisson Jul 30 '16 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 '16 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 '16 at 15:35
  • Can't i just find these files , download and put where they were? – John Jul 30 '16 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 '16 at 15:38
  • Alright thank you very much i am going to try the reinstall. – John Jul 30 '16 at 15:41
  • Tom is right - you need the files in /usr/bin to restore things to /usr/bin and the system is likely to do more damage to user data and files if you keep it running. Power it down and boot from another os (recovery, DVD, USB, OS installer) and then assess the damage or just reinstall the OS itself. – bmike Jul 30 '16 at 16:50