1. Make sure you drag the Visual Studio Code application into the Applications folder
Otherwise (as noted in the comments), you’ll have to go through this process again after a reboot.
2. Next, open Visual Studio Code
Open the Command Palette via ⇧ + ⌘ + P and type shell command
to find the Shell Command:
Use the Uninstall ‘code’ command in the PATH command before the “Install ‘code’ command in PATH” command.
After executing the command, restart the terminal for the new $PATH
value to take effect. You’ll be able to simply type ‘code .’ in any
folder to start editing files in that folder. The “.” Simply means “current directory”
(Source: Visual Studio Code documentation)
Note: If you’re running a build based off the OSS repository, you will need to run code-oss .
(Dzeimsas Zvirblis’ comment)