I\'d like to run / open Visual Studio Code from the Mac OSX Terminal by running this command code .
. I found instructions here:
https://code.visualstud
For Mac users:
One thing that made the accepted answer not work for me is that I didn't drag the vs code package into the applications folder
So you need to drag it to the applications folder then you run the command inside vs code (shown below) as per the official document
code () {
if [[ $# = 0 ]]
then
open -a "Visual Studio Code"
else
echo "Opening: "$@
"/Applications/Visual Studio Code.app/Contents/MacOS/Electron" $@
fi
}
I put that into my .bash_profile
I tested it and it works.
To set up VS code path permanently on Mac OS;
just open .bash_profile using the following command on terminal
open -t .bash_profile
Then add the following path to .bash_profile
code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;}
save the .bash_profile file and quit the terminal. Then reopen the terminal and type code .
to open VS code.
Try this one
Open Visual Studio Code and press Command + Shift + P or F1 then type Shell
in command palette now you are able to find this option like Shell Command : Install code in PATH
from suggested list in command palette. Select that options.
That's it.
Now open your terminal type.
$ code .
open finder and go to applications and make sure that vscode exists there ,then open type in terminal export PATH="/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
If you are on Mac OSX Maverick,
it's ~/.bash_profile
not ~/.bashrc
Try putting the code in there, close the terminal and then try again. Should be working