How to run Visual Studio Code on Mac OSX

April 7, 2020

EDIT: You can just do this from Visual Studio Code now.

Terminal

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 "com.microsoft.VSCode" --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

SignalR Mastery: Become a Pro in Real-Time Web Development

Join the thousands of developers who have already taken their first steps into building real-time web applications with SignalR.

The best SignalR Course I've ever watched ever. explaining all the details you need to know and even more about SignalR technology.
Exactly what I am looking for. Really appreciate the real world scenario. Thank you.
The author of the course really shows he knows what he is talking about. Very awesome!

Zsh

Using Visual Studio Code on your Mac, but can't call it from Zsh?

Currently, there isn't an automatic method for doing this, but with a little code in your

.zshrc
file, you can configure it.

function code {
    if [[ $# = 0 ]]
    then
        open -a "Visual Studio Code"
    else
        local argPath="$1"
        [[ $1 = /* ]] && argPath="$1" || argPath="$PWD/${1#./}"
        open -a "Visual Studio Code" "$argPath"
    fi
}

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