6

I am following the following instructions https://code.visualstudio.com/docs/setup/mac but I have no success. This is what happens when I enter

➜  ~ shell command

I am getting the following:

zsh: command not found: shell

I looked up the following question as well How to open Visual Studio Code from the command line on OSX?, it didn't help.

I have only one terminal option in the VSCode, zsh.

sheidaei
  • 9,842
  • 20
  • 63
  • 86

2 Answers2

13

In order to have code open Visual Studio Code from the terminal, you need to add it to the PATH by starting it (from the Launchpad, or Applications), then open its command palette by entering cmd + shift + P. A little text box you can type into will pop up near the top of the window. Type in "shell command" and with the arrow keys you should navigate to the option that says Install 'code' command in PATH and press ENTER.

Now you can cd into a directory and do code . to open VS Code with that directory as the working project directory.

You might need to close and reopen your terminal in order for your shell to use the new alias.

glhrmv
  • 1,712
  • 1
  • 16
  • 23
  • Thanks, it seems that I wasn't using the proper combinations of the keys and I was opening the Terminal instead of the command palette. – sheidaei May 30 '17 at 18:48
2
  1. Open Visual Studio
  2. cmd + P(MacOS) or CTRL + P(windows)
  3. will executed a search floating text
  4. type '>shell'(with out the single quotes)
  5. choose/select from the options "Shell Command: Install PATH..."

all set !

Peyman Mohamadpour
  • 17,954
  • 24
  • 89
  • 100