MacOS – Deleted /usr/local/bin and /usr/bin on OS X

macospythonterminal

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?

Best Answer

/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.