Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I run vscode with sudo on osx?

[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

like image 382
chadbr Avatar asked Jan 18 '16 18:01

chadbr


People also ask

How do I run VS Code as root on Mac?

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!

How do I run Visual Studio as administrator on Mac?

From the right-click or context menu of Visual Studio 2019 or Visual Studio 2022, select More > Run as administrator.


1 Answers

The following should do it:

sudo /Applications/Visual Studio Code.app/Contents/MacOS/Electron
like image 80
Benjamin Pasero Avatar answered Sep 23 '22 03:09

Benjamin Pasero