"code ." Not working in Command Line for Visual Studio Code on OSX/Mac

Mona Jalal picture Mona Jalal · Apr 30, 2015 · Viewed 267.4k times · Source

The command "code ." doesn't work in this manual?

All the other steps before that worked. How can I call the Visual Studio Code in OSX terminal?

Monas-MacBook-Pro:myExpressApp mona$ pwd
/Users/mona/nodejs/myExpressApp
Monas-MacBook-Pro:myExpressApp mona$ code .
-bash: code: command not found

EDIT: I ended up opening it from within Visual Code Studio by changing the workspace but I am wondering why that command "code ." won't work? enter image description here

Answer

Mark Pieszak - Trilon.io picture Mark Pieszak - Trilon.io · Sep 21, 2016

1. Make sure you drag Visual Studio Code app into the -Applications- folder

Otherwise (as noted in the comments) you'll have to go through this process again after reboot


2. Next, open Visual Studio Code

Open the Command Palette via (⇧⌘P) and type shell command to find the Shell Command:

> Install 'code' command in PATH** command.

![Command Palette

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. The "." Simply means "current directory"

(Source: VS Code documentation)


NOTE: If you're running a build based off the OSS repository... You will need to run code-oss . @Dzeimsas Zvirblis