Set the macOS launchd user PATH from a zsh login shell, so GUI apps launched from Finder, Spotlight, Dock, and other launchd-managed contexts can see the same command-line tools as a terminal login shell.
This is useful for desktop apps that run tools such as gh, node, dotnet, rp-cli, brew, or other binaries installed through Homebrew, user-local toolchains, or language package managers.
The LaunchAgent runs at login:
/bin/zsh -lc 'launchctl setenv PATH "$PATH"'That asks zsh to build the login-shell PATH from normal startup files such as .zprofile, then writes that value into the current user's launchd environment.
./scripts/install.shThe installer copies launch-agents/local.path-from-login-shell.plist to:
~/Library/LaunchAgents/local.path-from-login-shell.plist
Then it loads and kickstarts the LaunchAgent for the current login session.
./scripts/uninstall.shThis unloads the LaunchAgent and removes the installed plist. It leaves the current launchd PATH value alone by default.
To also clear the current launchd PATH value:
./scripts/uninstall.sh --unset-currentKeep PATH construction in a login-shell-safe startup file, normally .zprofile.
Good candidates:
- Homebrew
brew shellenv - Tool directories such as
$HOME/.local/bin,$HOME/.dotnet/tools,$HOME/.bun/bin - Static exports that are safe in non-interactive shells
Avoid putting interactive-only setup in .zprofile, because this agent runs a non-interactive login shell. Put prompts, aliases, terminal UI setup, and completions in .zshrc.
launchctl getenv PATH
/bin/zsh -lc 'printf "%s\n" "$PATH"'Those should match closely. A running app may need to be restarted before it sees a changed launchd environment.