Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I edit .bash_profile with Visual Studio Code? It gives me a permission error

I want to edit .bash_profile with VS Code, but it presents a permission error when I try to save. Sublime typically prompts me with a Administrator login prompt.

Here's my current workflow...

  1. From the Terminal, code ~/.bash_profile
  2. Edit file in VS Code
  3. Command+S
  4. Permission Error: denied
like image 284
Ryan J. Salva Avatar asked Sep 11 '25 03:09

Ryan J. Salva


1 Answers

Running vscode under sudo permissions is coming in the April release. Initially you will need to launch a new instance of VSCode and it will only be able to edit root-owned files, see https://github.com/Microsoft/vscode/issues/3068 for more details on the feature.

However, I recommend you change the ownership of ~/.bash_profile though as there's not reason you shouldn't be owning that file:

sudo chown YOUR_USER_NAME ~/.bash_profile
like image 182
Daniel Imms Avatar answered Sep 13 '25 19:09

Daniel Imms