fix-path
Fix the $PATH environment variable on macOS and Linux when your app is launched from a GUI
Repository Health
Technical Analysis
GUI applications launched from Finder, Dock, or a desktop launcher on macOS and Linux do not inherit the $PATH defined in shell dotfiles (.bashrc, .zshrc, etc.), so any child process they spawn can fail to find binaries installed via Homebrew, nvm, or similar tools. fix-path is a single-function utility, built by Sindre Sorhus, that resolves the user’s real shell $PATH and overwrites process.env.PATH with it.
It is most commonly used inside Electron apps, where spawning CLI tools (git, node, compilers) from a packaged, GUI-launched app otherwise fails silently because the process only sees the minimal PATH the OS gives GUI apps.
What You Get
- A single
fixPath()function that overwritesprocess.env.PATHin place - Automatic no-op behavior on Windows, where the GUI-PATH problem doesn’t exist
- Delegation to the
shell-pathpackage to resolve the user’s actual login-shell PATH - ANSI-stripped, clean PATH output safe to use directly in
child_processcalls - Zero configuration — a single import and function call
Common Use Cases
- Electron apps that need to spawn CLI tools (git, ffmpeg, compilers) reliably when launched from Finder or Dock
- macOS menu-bar / tray apps that shell out to Homebrew-installed binaries
- Desktop automation tools that need the same PATH a user’s terminal session would have
- Any GUI-launched Node.js process that fails to find a binary present in the user’s shell PATH
Under The Hood
Architecture: The entire implementation is a single exported function in index.js — it checks process.platform, returns immediately on win32, and otherwise calls shellPathSync() from the shell-path package to spawn the user’s login shell and capture its resolved $PATH, falling back to a hardcoded list of common binary locations if that fails. Tech Stack: Modern ESM-only Node.js module (type: module, Node >=20 engine requirement), with shell-path and strip-ansi as its only two runtime dependencies. Code Quality: Tested with ava plus tsd for type-definition testing and linted with xo; the codebase is small enough (a few dozen lines) that the test suite exercises the full behavior directly. API Design: The API is maximally minimal — one default export, no arguments, no return value, mutates process.env.PATH as a side effect — which is exactly the ergonomics wanted for a one-line startup fix.
Used by 6 apps in this directory
AionUi
AI Agents · Productivity
Free, open-source Cowork desktop app that unifies Claude Code, Codex, Gemini CLI, and 20+ AI agents into a single platform with multi-agent teams, 24/7 cron automation, and zero-config built-in agent.
AnythingLLM
Developer Tools · Automation · AI Assistants
The all-in-one AI platform for private document chat, no-code agents, and local LLMs with zero setup friction.
Dyad
AI Development · Productivity · AI Code Assistants
Build AI-powered apps locally with your own keys, your own models, and zero cloud lock-in.
LobeHub
AI Assistants · Productivity · Automation
Your Chief Agent Operator — build, schedule, and collaborate with an entire AI team in one self-hostable workspace.
localforge
AI Code Assistants · AI Agents · Developer Tools
A local, multi-provider AI coding agent with a real desktop and web UI — bring your own Anthropic, OpenAI, Gemini, Bedrock, or local Ollama keys and let it read, edit, and run code in your own project folder.
Multica
AI Assistants · AI Development
Turn coding agents into real teammates — assign issues, track progress, and compound reusable skills across a vendor-neutral, self-hosted platform.