[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
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!
From the right-click or context menu of Visual Studio 2019 or Visual Studio 2022, select More > Run as administrator.
The following should do it:
sudo /Applications/Visual Studio Code.app/Contents/MacOS/Electron
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With