After downloading VSCode, it's probably just a binary sitting in your Downloads folder. The first thing you want to do is copy that binary into your /Applications
folder. (Or open Explorer windows for both folders and just drag and drop the VSCode icon into the Applications folder.)
Next, you'll want to make a link to the VSCode app in your user binary folder. (If you don't have one, create it first and then come back.)
Double-check the location of the VSCode binary (mine is at /Applications/Visual Studio Code.app/Contents/Resources/app/bin/code
). Create a soft link to it like so:
ln -s '/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code' ~/bin/code
Note: I named my link
code
, which is what I prefer, but you can usevscode
oredit
for example if you prefer that.
Now you can quickly open a new VSCode window in any folder from the command line by typing:
code .
If you want to open a specific file, VSCode will automatically open it in the "correct" VSCode window (if you've opened one for that folder). If you haven't, by default it will open the file in whatever the last VSCode editor you were using. This is convenient for just quickly editing one-off files, like your zshrc for example:
code ~/.zshrc
Happy editing!