If I need to open a file or folder in Visual Studio Code, I use code
command. It was working fine for long. All of a sudden, it stopped working.
Reason
The exact reason why it stopped working, I am not sure. I doubt it has something to do with VS code software update.
Solution
Every time when I get this issue below solution worked for me.
Click Shift+Cmd+P to open the command pallete.
Search for Shell command: Uninstall code command from PATH
. Run that command. It will remove the code command from PATH.
Then, search for Shell command: Install code command in PATH
. It will install it again.
For uninstalling and installing, it will ask your root permissions.
After that the code
command starts working from any terminal.