HomeContact
Console
Add VS Code path easily to your console
March 10, 2021
1 min

Sometime you want to open a specific file from your command line easily into VS Code, but when entering code myfile.js in your terminal you will get an error :

$ code myfile.js
zsh: command not found: code

To solve that, simply open VS Code (work on MacOS, Linux and Windows) and hit the F1 button.

For MacOS user, you’ll may need to use Fn + F1 (lower brightness) or if you have a Touch Bar, when hitting Fn, F1 should appear on the touch Bar.

A command line should appear at the top of the screen, type path then select the line Shell Command: Install 'code' command in PATH:

Add VS Code PATH
Add VS Code PATH

You will get a confirmation message that the VS Code path has been added. You can now open a new terminal and open VS Code from it using :

$ code pathfile/namefile.js

VS Code will open the file directly and you will be able to modify it without any hassle ! This can be particularly useful when modifying system files (MacOS, Linux or Windows) as VS Code will handle for you the request for access for modifying it (Overwrite with admin privilege).


Tags

consolevscode

Related Posts

Antigen, a plugin manager for Oh My ZSH
March 21, 2020
1 min
© 2023, All Rights Reserved.

Quick Links

Contact Us

Social Media