PC macOS [macOS] Fixing Visual Studio Code's code Shell Command Not Working on macOS 12.3

Overview

This guide explains how to fix the issue where VS Code’s code command stops working due to the removal of Python 2 in macOS 12.3.

Steps

1. Identifying the Cause

  • With the removal of Python 2 in macOS 12.3, running Visual Studio Code’s code Shell Command produces 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
    

2. Fixing the Issue

2.1. Navigate to the /usr/local/bin Directory

cd /usr/local/bin

2.2. Edit the code File Using vi or nano

nano code
# Before
function realpath() { python -c ...

# After
function realpath() { python3 -c ...

References

Owners:

Planning
binaryloader
Research
binaryloader
Drafting
binaryloader
Editing
binaryloader
Review
binaryloader
Translation
Claude
Thumbnail
Claude
Publishing
binaryloader

Leave a comment