code: command not found
The terminal cannot find the Visual Studio Code command-line launcher because its installation folder is missing from PATH.
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
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
code --version where.exe code
Step-by-step fix
code --version
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
$ code . bash: code: command not found
$ 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.