How to run Visual Studio Code from Terminal on Mac OSX

May 7, 2015

Edit 06/24/2016: You can just do this from Visual Studio Code now.

Edit 12/10/2015: Thanks for commenter on letting know that latest release of Code broke original post. Updated with code from documentation.

Using Visual Studio Code on your Mac, but you want to use it in Terminal?

Using Zsh? Go here

Currently, there isn't an automatic method for doing this, but with a little code in your ~/.bash_profile file, you can configure it.

code () { VSCODE_CWD="$PWD" open -n -b "" --args $* ;}

Then from Terminal you can type:

code -- opens Visual Studio Code
code . -- opens current directory in Visual Studio Code
code somefile -- opens somefile in Visual Studio Code