summaryrefslogtreecommitdiff
path: root/config/zshenv
diff options
context:
space:
mode:
Diffstat (limited to 'config/zshenv')
-rw-r--r--config/zshenv23
1 files changed, 23 insertions, 0 deletions
diff --git a/config/zshenv b/config/zshenv
new file mode 100644
index 0000000..53580a7
--- /dev/null
+++ b/config/zshenv
@@ -0,0 +1,23 @@
+# ~/.zshenv — read by *every* zsh, including non-interactive, non-login ones.
+#
+# For `ssh <host> <command>`, `zsh -c ...` and plain scripts this is the *only*
+# startup file zsh reads: ~/.zprofile and ~/.zshrc are both skipped, and on
+# macOS so is /etc/zprofile, which is what runs path_helper. Without this file
+# such shells start with the bare system PATH (/usr/bin:/bin:/usr/sbin:/sbin).
+#
+# That broke `mosh <macos-host>`: mosh launches mosh-server over ssh as a
+# non-interactive command, and Homebrew's /opt/homebrew/bin was not on PATH, so
+# it died with "command not found: mosh-server". Linux hosts happened to work
+# only because mosh-server lives in /usr/bin there.
+#
+# Keep this file a thin shim. The actual environment lives in config/env, which
+# is POSIX sh so bash can share it. Interactive-only setup (aliases, history,
+# theme, profile.d, jenv) belongs in config/profile, sourced from ~/.zshrc.
+
+# Keep $path/$PATH free of duplicates for the life of this shell. zsh-only, so
+# it lives here rather than in the POSIX config/env.
+typeset -U path PATH
+
+[ -r "$HOME/.env" ] && . "$HOME/.env"
+
+# vim: filetype=zsh