sheidaei
sheidaei

Reputation: 10342

How to run Visual Studio Code from the command line?

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.

Upvotes: 7

Views: 9129

Answers (2)

Chedro Cardenas
Chedro Cardenas

Reputation: 21

  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 !

Upvotes: 2

glhrmv
glhrmv

Reputation: 1782

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.

Upvotes: 16

Related Questions