Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 659
sheidaei Avatar asked May 30 '17 18:05

sheidaei


People also ask

How do I run Visual Studio in terminal?

The Visual Studio terminal is built on top of Windows Terminal. To open the terminal in Visual Studio, select View > Terminal.


2 Answers

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.

like image 149
glhrmv Avatar answered Jan 04 '23 04:01

glhrmv


  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 !

like image 24
Chedro Cardenas Avatar answered Jan 04 '23 04:01

Chedro Cardenas