Erased /usr/bin/env on accident. How can I restore it?

I accidentally deleted /usr/bin/env and it causing issues when I want to run

brew install python

I am getting the following error:

brew install python3
/usr/local/bin/brew: line 91: /usr/bin/env: No such file or directory
/usr/local/bin/brew: line 91: exec: /usr/bin/env: cannot execute: No such file or directory

I know this was a mistake, can anyone help me get this file back?


There are quite a few ways to get that file back. It's pretty standard, so you could copy it from a backup or another Mac. You can also just reinstall the OS from recovery and a new system is written and your account and apps all remain intact.

Here is the canonical answer with lots of options:

  • How can I get back a system file after deleting it from my Mac?