Recently, when trying to run code .
from terminal, I got the following error:
/usr/local/bin/code: line 6: python: command not found
/usr/local/bin/code: line 10: ./MacOS/Electron: No such file or directory
After searching on google, I found that Github issue #141738. The problem was Apple removed support for Python 2 on macOS 12.3. Therefore when code
is trying to run python
command, it will fail.
To fix the issue, do the following steps.
I got mine working by:
cd /usr/local/bin
nano code
python
=> python3
on the following line- function realpath() { python -c ...
+ function realpath() { python3 -c ...
To save the file on nano, press Ctrl + Option + o
. Restart the terminal, and now code .
works!