Reputation: 1406
[Edit] VSCode just makes this work these days...
code ./.zshrc
I want to use vs code to edit .bash_profile
I setup the bash command (ala https://code.visualstudio.com/Docs/editor/setup)
edit... command prompt setup is now here: https://code.visualstudio.com/docs/setup/mac
if I type "sudo code .bash_profile" - I get "sudo: code: command not found"
Thanks - Chad
Upvotes: 18
Views: 64534
Reputation: 81
The problem is the git folder has no permission to the user save in it.
sudo chown -R youruser git_folder/
That's the way I solve this.
Upvotes: 8
Reputation: 21
Try Below Command :
sudo /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code
Upvotes: 1
Reputation: 8055
In case of a default installation (e.g.: under default applications folder)
Try running
sudo open /Applications/Visual\ Studio\ Code.app
After you make a save on a protected file it will ask you, then just hit overwrite it will prompt for your sudo password.
if you are not sure about the location of you VSCode app, just drag and drop the icon from where it is to the terminal, it will print the path automatically after the dragging, after that just exec sudo open
command and append the path, in my case was the one above, hope this helps!
Upvotes: 13
Reputation: 123934
The following should do it:
sudo /Applications/Visual Studio Code.app/Contents/MacOS/Electron
Upvotes: 27