Skip to main content

Programming, Day 3, Setting up VS Code to launch from the Command Line in OS X

Problem:
I wanted to launch Microsoft’s Visual Studio Code from the command line at will.

What I did:

  1. Launch VS Code
  2. Hit cmd-shift-p (⌘-⇧-P)
  3. Begin to type Shell … and choose and execute “Shell Command: Install 'code' command in PATH”
  4. Launch Terminal and check to see if VS Code launches by typing the code command.
  5. Edit the .bash_profile file in the home folder and change the $EDITOR variable like so …

# Setting Visual Studio Code as $EDITOR
export VISUAL=code
export EDITOR="$VISUAL"

And that should just about do it.

Restart the terminal or source the bash_profile file for changes to take effect.