Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code doesn't add command line on path permanently on Mac

I am using VS code 1.8.1 on Mac 10.12.3 (16D32). After launch vscode, I run cmd shift p to open command search field. Then run Install code command in Path. I can see the code got added on PATH but it got removed after I close vs code. Is there a way to add it permanently?

like image 861
Joey Yi Zhao Avatar asked Mar 02 '17 01:03

Joey Yi Zhao


People also ask

How do I permanently install a code in PATH Mac?

Launching from the command line# You can also run VS Code from the terminal by typing 'code' after adding it to the path: Launch VS Code. Open the Command Palette (Cmd+Shift+P) and type 'shell command' to find the Shell Command: Install 'code' command in PATH command.

How do I bring up the terminal in VS Code Mac?

Use the View > Terminal menu command. From the Command Palette (Ctrl+Shift+P), use the View: Toggle Terminal command.

Should I add to PATH when installing VS Code?

Windows and Linux installations should add the VS Code binaries location to your system path. If this isn't the case, you can manually add the location to the Path environment variable ( $PATH on Linux). For example, on Windows, VS Code is installed under AppData\Local\Programs\Microsoft VS Code\bin .


2 Answers

So I've just had this issue during setup of a new laptop and found a simple (but slightly embarrassing) solution that worked for me. After faffing about with it for way too long I noticed I had left it in Downloads. I moved the .app file to /Applications and ran the command-line install function again and now the "code" command persists.

like image 116
Kushal Avatar answered Sep 21 '22 06:09

Kushal


Add this to your ~/.bash_profile

export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"

source: https://code.visualstudio.com/docs/setup/mac

like image 22
Ryan Efendy Avatar answered Sep 20 '22 06:09

Ryan Efendy