How to permanently open the Visual Studio Code with code . command in terminal

Krishna Bagale
1 min readSep 26, 2020

--

  • At first, open your terminal and go to your root user directory. Something like /Users/krishnabagale
  • Type open -t .bash_profile
  • Then add the following path to .bash_profile

code () { VSCODE_CWD=”$PWD” open -n -b “com.microsoft.VSCode” — args $*

  • Save the bash profile and quit the terminal. Now you can open any file/folder to VsCode with code .

--

--

Krishna Bagale
Krishna Bagale

Written by Krishna Bagale

I am a software developer, living in Finland. I am open for new innovative ideas and willing to formulate into reality. Keep contact!

No responses yet