Wanna see something cool? Check out Angular Spotify 🎧
All Articles

/usr/local/bin/code: line 6: python: command not found

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

/usr/local/bin/code: line 6: python: command not found

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:

  1. cd /usr/local/bin
  2. nano code
  3. change 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!

/usr/local/bin/code: line 6: python: command not found

Published 19 Apr 2022

    Recent Posts

    My React Reading List

    My collection of React articles and video that I read and enjoyed.

    Multiple ng-content

    How to reuse multiple unamed ng-content in Angular


    Follow @tuantrungvo on Twitter for more!