diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 07f584ff22acb..e46c3c61ee68c 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -981,7 +981,13 @@ substituteAllInPlace() { # the environment used for building. dumpVars() { if [ "${noDumpEnvVars:-0}" != 1 ]; then - install -m 0600 <(export 2>/dev/null) "$NIX_BUILD_TOP/env-vars" || true + # On darwin, install(1) cannot be called with /dev/stdin or fd from process substitution + # so first we create the file and then write to it + # See https://github.com/NixOS/nixpkgs/issues/335016 + { + install -m 0600 /dev/null "$NIX_BUILD_TOP/env-vars" && + export 2>/dev/null >| "$NIX_BUILD_TOP/env-vars" + } || true fi }