diff --git a/pkgs/nix-tools/darwin-rebuild.sh b/pkgs/nix-tools/darwin-rebuild.sh index aa066865..c0ea55b7 100644 --- a/pkgs/nix-tools/darwin-rebuild.sh +++ b/pkgs/nix-tools/darwin-rebuild.sh @@ -18,7 +18,11 @@ showSyntax() { } sudo() { + # REMOVEME when support for macOS 10.13 is dropped + # macOS 10.13 does not support sudo --preserve-env so we make this conditional if command sudo --help | grep -- --preserve-env= >/dev/null; then + # We use `env` before our command to ensure the preserved PATH gets checked + # when trying to resolve the command to execute command sudo -H --preserve-env=PATH env "$@" else command sudo -H "$@"