0

I am using Visual Studio Code, but I can't run the option "install code command in path", because this command does not appear when I type Shift + Ctrl + P. I am using Windows 10 and the latest version of Visual Studio Code.

I tried many steps to solve my problem, but with no success. Here is what I did:

  1. Reinstalled Visual Studio Code (the latest version), and checked the option to add to the PATH variable. Didn't work.
  2. Opened Environment Variables and edited the Path user variable, restarted the computer. Didn't work.
  3. Opened command prompt and typed code .. Didn't work.

What should I do next?

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
Joe
  • 1
  • 1
  • 1
  • Are you on a Mac? Did you access the shell first? See the instructions here: https://code.visualstudio.com/docs/setup/mac – DeborahK Nov 28 '18 at 18:19
  • Possible duplicate of [visual studio code "Shell Command: Install 'code' command in PATH command."](https://stackoverflow.com/questions/47528373/visual-studio-code-shell-command-install-code-command-in-path-command) – Gino Mempin Nov 29 '18 at 00:33

2 Answers2

1

When using Visual Studio Code and:

  1. code . does not work
  2. "install code command in path" doesn't exist in Visual Studio Code

Manually add VS Code to your path using the following command in Git:

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 .bash_profile changes.

Note: The leading slash \ is required to prevent $PATH from expanding during the concatenation. Remove the leading slash if you want to run the export command directly in a terminal.

Note: Since zsh became the default shell in macOS Catalina, run the following commands to add VS Code to your path:

cat << EOF >> ~/.zprofile
# Add Visual Studio Code (code)
export PATH="\$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
EOF
-1

With Windows it is installed by default so you don't need to add path. Just run " code . " in cmd and it will work fine