
Give your terminal the superpower to summon VS Code instantly. Say goodbye to tedious file dragging.
Introduction
Have you ever watched those developers who casually type code . in their terminal and instantly open an entire project? Meanwhile, you’re still clicking through folders in Finder and dragging them into VS Code? This guide will help you catch up on this “missed installation step.”
The code command doesn’t just open files and folders—it supports line number jumping, diff comparisons, and other advanced features. For developers, this is a productivity game-changer.
Method 1: Command Palette Installation (Recommended)
This is the standard installation method provided by VS Code—simple and quick:
-
Open VS Code
-
Launch Command Palette: Press
Cmd + Shift + P(macOS) orCtrl + Shift + P(Windows/Linux) -
Search for the command: Type
shell command -
Execute installation: Select “Shell Command: Install ‘code’ command in PATH”

The terminal will immediately display a success message.
Method 2: Manual PATH Configuration (Alternative)
If Method 1 doesn’t show the shell command option, VS Code might not be in the standard location. You can manually add it to your PATH:
macOS (zsh, system default):
|
|
macOS (bash):
|
|
Linux:
|
|
Method 3: Ensure VS Code Is in the Correct Location
Sometimes the installation option doesn’t appear because VS Code isn’t in the /Applications/ directory:
- Check if VS Code is in the Applications folder
- If you opened it from the Downloads folder, drag it to
/Applications/ - Completely quit VS Code (
Cmd + Q) - Reopen VS Code and try Method 1 again
Verify Installation
After installation, verify it works:
|
|
Common code Commands Quick Reference
| Command | Function |
|---|---|
code . |
Open VS Code in current directory |
code filename |
Open a specific file |
code -r filename |
Open file in existing window |
code -n |
Open a new VS Code window |
code --diff a b |
Compare differences between two files |
code --list-extensions |
List installed extensions |
Conclusion
Installing the code command takes just 30 seconds but can significantly boost your development efficiency. Whether you’re quickly opening projects, jumping to specific code lines, or comparing files, this command is an essential skill for terminal-based developers.
If you encounter installation issues, first check if VS Code is in the standard Applications directory, then try the manual PATH configuration approach.