Launching VSCode from the Command Line
You can also run VSCode from the terminal by typing
code after adding it to the path:
- Launch VSCode.
- Open the Command Palette (
⇧⌘P) and type
shell commandto find the Shell Command: Install ‘code’ command in PATH command.
- Restart the terminal for the new
$PATHvalue to take effect. You’ll be able to type
code .in any folder to start editing files in that folder.
Note: If you still have the old
codealias in your
.bash_profile(or equivalent) from an early VS Code version, remove it and replace it by executing the Shell Command: Install ‘code’ command in PATH command.
To manually add VS Code to your path:
cat << EOF >> ~/.bash_profile # Add Visual Studio Code (code) export PATH="\$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin" EOF
Start a new terminal to pick up your
Note: The leading slash
\is required to prevent
$PATHfrom expanding during the concatenation. Remove the leading slash if you want to run the export command directly in a terminal.
Source: Running VS Code on macOS