# Handle old versions of \`/usr/bin/env\` when loading shell env \(\#10202\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/b05aa381aa0f83c7f4809ca67b44568248626e55)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: b05aa381aa0f83c7f4809ca67b44568248626e55

Requested commit: b05aa381aa0f83c7f4809ca67b44568248626e55

Commit: b05aa381aa0f83c7f4809ca67b44568248626e55

Tree: 7c0c0214bbc59abc4e283980bc6a719aba43b9ae

Author: Thorsten Ball

Committer: GitHub

## Message

```
Handle old versions of `/usr/bin/env` when loading shell env (#10202)

This fixes #9786 by using an invocation of `/usr/bin/env` that's
supported by macOS 12.

As it turns out, on macOS 12 (and maybe 13?) `/usr/bin/env` doesn't
support the `-0` flag. In our case it would silently fail, since we
`exit 0` in our shell invocation and because the program we run and
whose exit code we check is the `$SHELL` and not `/usr/bin/env`.

What this change does is to drop the `-0` and instead split the
environment on `\n`. This works even if an environment variable contains
a newline character because that would then be escaped.

Release Notes:

- Fixed Zed not picking up shell environments correctly when running on
macOS 12. ([#9786](https://github.com/zed-industries/zed/issues/9786)).

Co-authored-by: Dave Smith <davesmithsemail@gmail.com>
```

## Parents

- [ec6efe262fd74f6c8e43e0a25f4264958f77f57c](https://git.cafe/gitcafe/zed/commit/ec6efe262fd74f6c8e43e0a25f4264958f77f57c?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/b05aa381aa0f83c7f4809ca67b44568248626e55?format=markdown)
