0

I'm attempting to add Visual Studio Code to my command line so I can open a project by typing 'code .'

I've followed the instructions on this page: https://code.visualstudio.com/docs/setup/mac and it works but does not remain permanent. Every time I restart my terminal the command line tools are gone and tells me command not found.

How can I add this permanently? My previous editor was Atom and I can't remember how I set that up to open from the command line.

Any help would be greatly appreciated.

  • 2
    Possible duplicate of [How to open Visual Studio Code from the command line on OSX?](https://stackoverflow.com/questions/29971053/how-to-open-visual-studio-code-from-the-command-line-on-osx) – Shubham May 13 '18 at 17:39

1 Answers1

0

What worked for me was to add:

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

to my .bash_profile file. Now whenever I type 'code' on the command line VScode opens.

Natsfan
  • 4,093
  • 3
  • 22
  • 29