Call VSCode on Mac from CLI:

This is how you can setup CLI programs to call VSCode editor. For example, git rebase or other commands that would normally open Pico/Nano, Vi et all can actually call VS Code all the same. Here is how you can set this up on a Mac:

First, Run this at your CLI:

cat << EOF >> ~/.bash_profile
  # Add Visual Studio Code (code)
  export PATH="\$PATH:/Applications/Visual Studio"

In my case I had renamed Visual Studio to So make sure it’s correctly typed before running the command. Also, go into your ~/.gitconfig file, and under the section titled [core] add the “editor” line as shown below.


    autocrlf = input
    excludesfile = ~/.gitignore
    pager = "less -FXR"
  > editor = code --wait

Now when you go to rebase a branch, for example, you would type:

git rebase -i master

…and it should open up the commit screen in VSCode!