- Visual Studio For Mac Limitations
- Visual Studio For Mac Download
- Visual Studio For Mac Os X
- Visual Studio For Mac Command Line
In this tutorial, I will show how to install visual studio code on mac. Visual Studio Code is free and available on your favorite platform – Linux, Mac OSX, and Windows.Download Visual Studio Code to experience a redefined code editor, optimized for building and debugging modern web and cloud applications.
The docs mention an executable called code
, but I'm not sure where I can find that so I can put it on my path. The zip I downloaded from the VSCode site did not include any such executable. (I am able to run the .app
just fine.)
Is this a Windows-only thing?
jessehouwing17 Answers
From the Visual Studio Code Setup page:
Visual Studio For Mac Limitations
Tip: If you want to run VS Code from the terminal by simply typing 'code', VS Code has a command, Shell Command: Install 'code' command in PATH, to add 'code' to your $PATH variable list.
After installation, launch VS Code. Now open the Command Palette (F1 or ⇧+⌘+P on Mac) and type shell command
to find the Shell Command: Install 'code' command in PATH
command.
After executing the command, restart the terminal for the new $PATH value to take effect. You'll be able to simply type 'code .' in any folder to start editing files in that folder.
Tracker1⚡️ The Easy Solution.
- Download, install and open Visual Studio Code.
- Open the Command Palette (⌘ + ⇧ + P on Mac) OR View ❯ Command Palette
🌟 3. Type shell command
to find Shell Command: Install 'code' command in PATH command
- Install it and you're done
📟 Here's a complimentary GIF.
After that, you can use code
or code .
in the terminal.

Cheers!
P.S. Theme name 🦄 Shades of Purple ↗
Ahmad AwaisAhmad AwaisWe since updated the script to the following syntax to support multiple files and folders as arguments and to fix an issue with not detecting the current working directory properly:
Update for our VS Code 1.0 release:
Please use the command Install 'Code' command in path
or Install 'code-insiders' command in path
from the command palette (View | Command Palette
) to make Code available to the command line.
If you want to open a file or folder on Visual Studio Code from your terminal
, iTerm
, etc below are the commands which come as default when you install Visual Studio Code
To open Visual Studio Code from command line
To open the entire folder/directory
To open a specific file
Sudharshan
I have a ~/bin/code
shell script that matches the command @BengaminPasero wrote.
I prefix ~/bin:
to my $PATH
which allows me to add a bunch of one off scripts without polluting my ~/.bash_profile
script.
After opening VSC and pressing (Command + Up + P) I tried typing in 'shell command' and nothing came up. In order to get 'Shell Command: Install 'code' command in PATH command' to come up, you must do the following:
Press (Command, Up, P)
Type
>
(this will show and run commands)Then type
Shell Command: Install 'code' command in PATH command
. It should then come up.Once you click it, it will update and you should be good to go!
This was the tutorial I was looking for in this thread. It shows the way to open files in Visual Studio Code by writing code .
1.- Open the file
Bash
Terminal OS
2.- Add in your file the :
3.- Reinicialize terminal and try in the folder you want to open
4.- Then you can use it as shown in this comment: https://stackoverflow.com/a/41821250/10033560
On OSX Mavericks I created a bash script named vscode
(adapted from the .bashrc
in VSCode Setup) in ~/bin
:
vscode <file or directory>
now works as expected.
I discovered a neat workaround for mingw32 (i.e. for those of you using the version of bash which is installed by git-scm.com on windows):
IlanIlanNote: Only for Windows Users.
As many folks already suggested ways to open code from command prompt using code .
command. This will only open Visual Studio Code Stable build. But If you have downloaded Visual Studio Code Insider build/version (Which has all latest build/features but unstable version) then you need to follow below instructions in windows :
- Go to Control PanelSystem and SecuritySystem. Click on Advanced System Settings
- Click on Environment Variables
- Under System Variables tab, Click on Edit for Path Variable
- Add a new path
C:UserstsabuAppDataLocalProgramsMicrosoft VS Code Insidersbin
(or)C:Program FilesMicrosoft VS Code Insidersbin
based on location at which you have installed vscode insider in your machine.
Open a new command prompt and typecode-insiders .
to open vscode-insider build/version
I had this issue because of VS Code Insiders.The path variable was there but I needed to rename the code-insiders.cmd inside to code.cmd .
Maybe this is useful to someone.
You can use the vscode:
protocol that Visual Studio Code defines:
You can also use
if you do not fancy modifying your path
xvergesxvergesVisual Studio For Mac Download
its very simple:
Launching from the Command Line
You can also run VS Code from the terminal by typing 'code' after adding it to the path:
Launch VS Code.Open the Command Palette (⇧⌘P) and type 'shell command' to find the Shell Command: Install 'code' command in PATH command.
source
JoolahJoolahAdded this to /usr/local/bin/code, you might have to modify the path if they are different.
Make executable afterwards
I ran: open -a 'Visual Studio Code' [folder-name]
to open a folder with my Visual Studio Code application. Folder name is optional if you just want to open the application. Not sure if this is exactly your use-case, but hope this helps!
The instruction given at VS Code Command Line for launching a path are incorrect; the leading colon shown in the example doesn't work. However, launching with a backslash terminated directory name opens the specified directory as expected.
So, for example,
code C:UsersDAVEDocumentsProgrammingAngularStringCalculatorsrc
opens the Visual Studio Code editor in directory C:UsersDAVEDocumentsProgrammingAngularStringCalculatorsrc
.
Important: The terminal backslash, though optional, is useful, as it makes clear that the intend is to open a directory, as opposed to a file. Bear in mind that file name extensions are, and always have been, optional.
Beware: The directory that gets appended to the PATH list is the bin
directory, and the shell command code
launches a Windows NT Command script.
Hence, when incorporated into another shell script, code
must be called or started if you expect the remainder of the script to run. Thankfully, I discovered this before my first test of a new shell script that I am creating to start an Angular 2 project in a local Web server, my default Web browser, and Visual Studio Code, all at once.
Following is my Angular startup script, adapted to eliminate a dependency on one of my system utilities that is published elsewhere, but not strictly required.
goto SKIPREM
:SKIPREM
For windows Usersjust type in
More commands herehttps://code.visualstudio.com/docs/editor/command-line
Bhargav Rao♦