Skip to content

Instantly share code, notes, and snippets.

@RoyZhang7
Last active March 26, 2023 03:10
Show Gist options
  • Select an option

  • Save RoyZhang7/52596795bb2ded0bd6748e695aa38b15 to your computer and use it in GitHub Desktop.

Select an option

Save RoyZhang7/52596795bb2ded0bd6748e695aa38b15 to your computer and use it in GitHub Desktop.
# By default, sudo does NOT pass the user's original PATH into the superuser process, and it gets some default PATH defined on the system.
# Following cmd pass user's PATH into sudo, replacing env with the commond you want.
sudo env PATH="$PATH" command
# Example of passing Latexmk's PATH
sudo env PATH="$PATH" latexmk -pdf -shell-escape -use-make main.tex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment