env: bash: Bad CPU type in executable

February 8, 2023

fix

I switched from a mid-2015 Macbook Pro to a 16-inch 2023 M2 Macbook Pro. I migrated my old system to my new system and after downloading and installing the Silicon version of VS Code, I was getting an error when I tried to open files using code in my terminal.

env: bash: Bad CPU type in executable

Homebrew was causing the issue, I decided to completely remove Homebrew and try to only reinstall what I needed.

Ran into some issues with the uninstall script being able to complete because of permissions. However, Homebrew was very helpful and listed out the directories it was having trouble removing and I was able to manually remove them. It was everything within /usr/local. Definitely take a look at what you have in there before you remove it. In my case, it was all things I got from Homebrew, so it was safe to delete.