DevFixes
HomeShellEditor and CLI
VS CodeBeginnerLow severity

code: command not found

The terminal cannot find the Visual Studio Code command-line launcher because its installation folder is missing from PATH.

2-10 min Popularity 90/100 Verified 2026-07-21
Debug with AI

What does this error mean?

Your shell searched every directory listed in the PATH environment variable and did not find the `code` launcher used to open Visual Studio Code from a terminal.

Why does this happen?

  • The VS Code command-line launcher was not added to PATH.
  • The terminal was opened before VS Code updated PATH.
  • VS Code is installed for another user or in a non-standard directory.
  • A WSL or remote terminal is trying to use the host command incorrectly.
  • The installation is incomplete or the launcher file was removed.

AI explanation

Plain-English analysis

VS Code may be installed and open normally while the shell still cannot launch it. The graphical application and the terminal command are separate entry points. Install or expose the `code` launcher for the current shell, restart that shell, and verify which executable resolves.

Quick fix

Terminal
code --version
where.exe code
Expected output: The command prints a VS Code version and the path to the code launcher. On macOS or Linux, use `command -v code` instead of `where.exe code`.

Step-by-step fix

1Install the code command from VS CodeOn macOS, run 'Shell Command: Install code command in PATH' from the VS Code Command Palette, then reopen the terminal.87%
2Restart the terminal after installationExisting terminal processes keep their old PATH value until they are restarted.70%
Command
code --version
3Add the VS Code bin directory to PATHLocate the installation's bin directory and add it to the current user's PATH.54%

Alternative solutions

Windows

where.exe code
& "$env:LOCALAPPDATA\Programs\Microsoft VS Code\bin\code.cmd" .

Re-run the installer with the Add to PATH option if the direct launcher works.

macOS

command -v code
code --version

Use the Command Palette action that installs the shell command, then open a new terminal.

Linux

command -v code
/usr/bin/code --version

Package-manager installations normally create /usr/bin/code automatically.

WSL

code .
which code

Install the VS Code Remote - WSL integration and launch from the WSL project directory.

Real example

Broken
shell
$ code .
bash: code: command not found
Corrected
shell
$ command -v code
/usr/local/bin/code
$ code .
# Visual Studio Code opens the current folder

Frequently asked questions

The graphical shortcut knows the application path, while the terminal only searches directories listed in PATH.

References