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?
For those of you that run ZShell with Iterm2, add this to your ~/.zshrc
file.
alias code="/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code"
Otherwise (as noted in the comments) you'll have to go through this process again after reboot
Open the Command Palette via (⇧⌘P) and type shell command
to find the Shell 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: VS Code documentation)
NOTE: If you're running a build based off the OSS repository... You will need to run code-oss .
@Dzeimsas Zvirblis
Define the path of the Visual Studio in your ~/.bash_profile as follow
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
For code .
to work in OSX terminal append code as described here https://code.visualstudio.com/Docs/setup but instead of to .bashrc
, in OSX try .profile
which is loaded at terminal session start.
https://code.visualstudio.com/Docs/setup
Tip: If you want to run VSCode from the terminal, append the following to your .bashrc file
code () {
if [[ $# = 0 ]]
then
open -a "Visual Studio Code"
else
[[ $1 = /* ]] && F="$1" || F="$PWD/${1#./}"
open -a "Visual Studio Code" --args "$F"
fi
}
Then $ source ~/.bashrc
EDIT: If this is happening on mint/ubuntu, it is likely because you installed vscode through the software manager. This will cause other problems during debugging. Instead install it using the .deb file on the vscode website.
If you really want to use the software manager, the solution below still works:
use find / -name code 2> /dev/null
to find the path to the visual studio bin file. It should end in /extra/vscode/bin/code
If you're using the mint software manager, you might only find paths with a ridiculously long name in the middle like this:
".../stable/7a22830d9e8fbbdc9627e43e072005eef66c14d2a4dd19992427ef4de060186a/..."
Just replace the long part with "/active/"
Once you have it, create a sym link:
ln -s path_you_found/extra/vscode/bin/code /usr/local/bin/code
If you don't have the rights, or only want it to be accessible for yourself, simply add this line to your .bashrc / .zshrc:
export PATH="$PATH:path_you_found/extra/vscode/bin/
Note that I removed the 'code' filename at the end