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 an OS X terminal?
pwd
/Users/mona/nodejs/myExpressApp
code .
-bash: code: command not found
I ended up opening it from within Visual Code Studio by changing the workspace, but why won't that command code .
part work?
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 (Cmd+Shift+P) and type 'shell command' to find the Shell Command: Install 'code' command in PATH command.
Changing Default Command Line Shell Then, click on the arrow on the side of a plus (+). Here, choose Select Default Profile. Then, select any other type of command line shell. Then, restart vs code and try working on terminal.
Otherwise (as noted in the comments), you'll have to go through this process again after a reboot.
Open the Command Palette via ⇧ + ⌘ + P and type shell command
to find the Shell Command:
Use the Uninstall 'code' command in the PATH command before the "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. The "." Simply means "current directory"
(Source: Visual Studio Code documentation)
Note: If you're running a build based off the OSS repository, you will need to run code-oss .
(Dzeimsas Zvirblis' comment)
If you want to add it permanently:
Add this to your ~/.bash_profile
, or to ~/.zshrc
if you are running macOS v10.15 (Catalina) or later.
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
Source: Visual Studio Code on macOS
Open the ~/.bashrc file using vi or Vim:
vi ~/.bashrc
Enter the following by pressing i
to insert:
code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;}
Save the file using :wq
Reflect the settings in ~/.bashrc using the following command:
source ~/.bashrc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With