Skip to content

fix(zsh): restore PATH entries orphaned by ZDOTDIR - #9

Merged
ptaranat merged 1 commit into
mainfrom
fix/zsh-orbstack-jetbrains
Sep 22, 2026
Merged

ptaranat merged 1 commit into
mainfrom
fix/zsh-orbstack-jetbrains

Conversation

@ptaranat

Copy link
Copy Markdown
Owner

The OrbStack and JetBrains Toolbox installers each appended their PATH
setup to ~/.zprofile. But .zshenv sets ZDOTDIR to ~/.config/zsh, and zsh
then reads .zprofile/.zshrc/.zlogin from $ZDOTDIR only, never $HOME, not
even for login shells. So ~/.zprofile has been dead for a long time and
docker, orb, kubectl and the Toolbox scripts silently fell off PATH.

Add them to .zshenv (appended, matching what the installers intended) plus
OrbStack's zsh completions on fpath. Verified from a clean env -i shell.

ptaranat commented Jul 20, 2026

Copy link
Copy Markdown
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restores PATH entries that were previously being appended to ~/.zprofile (but no longer sourced due to ZDOTDIR being set in .zshenv) by moving the relevant PATH setup into .zshenv, ensuring both interactive and non-interactive zsh invocations can find those tools.

Changes:

  • Append OrbStack binaries to path so docker, kubectl, and orb are available again.
  • Append JetBrains Toolbox scripts directory to path so Toolbox-managed scripts are on PATH again.
  • Add OrbStack zsh completions directory to fpath.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread dot_zshenv Outdated
Comment on lines +41 to +43
# OrbStack's completions. Its init.zsh sets only this and the PATH line above,
# so sourcing the file itself would add nothing.
fpath+=($HOME/.orbstack/shell/completions/zsh(N-/))

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping this in .zshenv on purpose. The file's "environment setup only" rule is about no output, no prompts, nothing slow; a plain fpath+= array append is none of those. Moving just the completions line to .zshrc would split OrbStack's setup across two files to spare non-interactive shells a single array entry, which isn't worth it. Added a comment in the code noting the deliberate exception.

@ptaranat

Copy link
Copy Markdown
Owner Author

Reworked onto the current main, still stacked on #8 since both edit .zshenv.

The original premise was partly stale and the comment in the file has been corrected. When this was written, it claimed docker, orb and kubectl had fallen off PATH. They had not, or at least no longer have: OrbStack's installer also symlinks docker, kubectl, orb and orbctl into /usr/local/bin, so those kept resolving by another route.

Measured it rather than assuming, by diffing a rendered .zshenv in an env -i shell with and without this change:

command without with
docker, docker-compose, kubectl, orb, orbctl ok ok
goland, datagrip, rider missing ok

So what this actually recovers is the JetBrains Toolbox scripts, which resolve nowhere else, plus OrbStack's zsh completions, which nothing else provides.

The OrbStack path entry is kept regardless, so this does not depend on symlinks written outside chezmoi's control, and (N-/) makes it free when the directory is absent. Appended rather than prepended, which also keeps Homebrew's versioned kubectl ahead of the copy OrbStack bundles.

The underlying ZDOTDIR point still stands: ~/.zprofile is 11 lines that zsh has never read since .zshenv started setting ZDOTDIR. Worth deleting separately, but it is outside the repo so I left it alone.

@ptaranat
ptaranat force-pushed the fix/zsh-orbstack-jetbrains branch from 18d82bb to c4e44b9 Compare September 22, 2026 15:56
@ptaranat
ptaranat deleted the branch main September 22, 2026 16:31
@ptaranat ptaranat closed this Sep 22, 2026
The OrbStack and JetBrains Toolbox installers each appended their PATH setup
to ~/.zprofile. But .zshenv sets ZDOTDIR to ~/.config/zsh, and zsh then reads
.zprofile, .zshrc and .zlogin from $ZDOTDIR only, never $HOME, not even for
login shells. That file has been dead ever since, and still is: 11 lines,
none of them read.

Scope is narrower than it first looks, and the comment in the file now says
so. The Toolbox scripts (goland, datagrip, rider) resolve nowhere else and
were genuinely unreachable. OrbStack's binaries were not: its installer also
symlinks docker, kubectl, orb and orbctl into /usr/local/bin, so those kept
working by another route. Its zsh completions had no other source either.

The OrbStack path entry is kept anyway so this does not rely on symlinks
written outside chezmoi's control, and (N-/) costs nothing when the directory
is absent. Appended rather than prepended, matching the installers, which also
keeps Homebrew's versioned kubectl ahead of the copy OrbStack bundles.

Verified against a rendered template in an `env -i` shell, diffed with and
without this change: goland, datagrip and rider go from unresolvable to
resolvable, the OrbStack completions land on fpath, and no existing entry
changes position.
@ptaranat ptaranat reopened this Sep 22, 2026
@ptaranat
ptaranat changed the base branch from fix/zsh-path-ordering to main September 22, 2026 16:32
@ptaranat
ptaranat force-pushed the fix/zsh-orbstack-jetbrains branch from c4e44b9 to 4d1b784 Compare September 22, 2026 16:32
@ptaranat
ptaranat merged commit 932aacf into main Sep 22, 2026
@ptaranat
ptaranat deleted the fix/zsh-orbstack-jetbrains branch September 22, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants