Skip to content

Instantly share code, notes, and snippets.

@crispyricepc
Last active May 4, 2021 12:55
Show Gist options
  • Save crispyricepc/e3b144dc1cfc3735451249a85b2aec77 to your computer and use it in GitHub Desktop.
Save crispyricepc/e3b144dc1cfc3735451249a85b2aec77 to your computer and use it in GitHub Desktop.
Run VSCode as sudo
#!/bin/bash
if [[ $EUID -eq 0 ]]; then
echo "This script cannot be run as root"
exit 1
fi
root_config_dir=$HOME/.codeconfig_root
mkdir -p $root_config_dir
sudo code --user-data-dir="$root_config_dir" "$@"

Simply curl this gist to ~/.local/bin and run chmod +x ~/.local/bin/pseudocode. Like so:

curl https://gist.githubusercontent.com/CRISPYricePC/e3b144dc1cfc3735451249a85b2aec77/raw/9db6ef79911d227f39d69c0895f7c7eaff22f0da/pseudocode > ~/.local/bin/pseudocode
chmod +x ~/.local/bin/pseudocode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment