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?
Here are the steps which I followed to make it working on MAC:
Install "Shell" extension from VSCode:
Restart VSCode.
Press F1 when VSCode is opened.
Type "Shell" and select the following option: Shell Command: Install 'code' command in PATH command
That will give you the following message: Shell command 'code' successfully installed in PATH.
Running "which code" command will give you a proof the code command working now:
Alternative to commandline Solution:
Recently I was playing with Services in Mac OS X. I added a service to a folder or file so that I can open that folder or file in Visual Studio Code. I think this could be an alternative to using 'code .' command if you are using the Finder app. Here are the steps:
Verify:
If you want to add it permanently:
Add this to your ~/.bash_profile
, or to ~/.zshrc
if you are running MacOS Catalina
or later.
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
source: https://code.visualstudio.com/docs/setup/mac
If you are on Windows and facing the same problem, have a look at this answer of @Inazense https://stackoverflow.com/a/52869803/4567504.
In Visual studio code I was not able to find “Shell Command: Install 'code' command in PATH command.” so I had to do this manually.
"C:\Users\Your_Username\AppData\Local\Programs\Microsoft VS Code\bin"
Now you are done! restart command prompt and try again
I foolishly deleted my /usr/local/bin/code
symbolic link and did not know the correct path. A brew reinstall recreated it:
brew cask reinstall visual-studio-code
path turned out to be:
/usr/local/bin/code ->
'/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code'
If you have trouble using the Command Palette solution, you can manually add VS Code to the $PATH
environment variable when your terminal starts:
cat << EOF >> ~/.bash_profile
# Add Visual Studio Code (code)
export PATH="$PATH:/Applications/Visual Studio
Code.app/Contents/Resources/app/bin"
EOF