DEV Community

Bartłomiej Stefański
Bartłomiej Stefański

Posted on • Originally published at bstefanski.com on

🛠️ Quickly Launch VSCode from Terminal as Admin (2023)

I wanted to utilize the code . command in the terminal to directly open VSCode in my desired directory. To achieve this, I navigated to the VSCode Command Palette and chose >Shell Command: Install 'code' command in PATH. However, I encountered an error message stating "permissions denied" and that administrator access was required for this action.

After some searching, I discovered several solutions to run VSCode as an administrator. The following command was the only one that worked for me:


$ sudo /Applications/Visual Studio Code.app/Contents/MacOS/Electron; exit

Enter fullscreen mode Exit fullscreen mode

Upon executing this command, VSCode should open, allowing you to select the >Shell Command: Install 'code' command in PATH option.

Top comments (0)