fix-path

Fix the $PATH environment variable on macOS and Linux when your app is launched from a GUI

Library
npm
v5.0.0
301stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
37/100Needs Attention
Development Activity4
Maintenance20
Community44
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
69/100Good
Architecture55
Code Quality70
Innovation60
Learning Curve90

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 overwrites process.env.PATH in place
  • Automatic no-op behavior on Windows, where the GUI-PATH problem doesn’t exist
  • Delegation to the shell-path package to resolve the user’s actual login-shell PATH
  • ANSI-stripped, clean PATH output safe to use directly in child_process calls
  • 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

TypeScript
95%
Apache 2.0

AionUi

AI Agents · Productivity

32,102

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.

View details
88
Repo Health
76
Technical
66
Dependency
Built with
TypeScript95%
Updated today
JavaScript
95%
MIT

AnythingLLM

Developer Tools · Automation · AI Assistants

64,914

The all-in-one AI platform for private document chat, no-code agents, and local LLMs with zero setup friction.

View details
91
Repo Health
78
Technical
68
Dependency
Built with
JavaScript95%
Updated today
TypeScript
96%
Other

Dyad

AI Development · Productivity · AI Code Assistants

21,279

Build AI-powered apps locally with your own keys, your own models, and zero cloud lock-in.

View details
88
Repo Health
83
Technical
70
Dependency
Built with
TypeScript96%
Updated today
TypeScript
99%
Other

LobeHub

AI Assistants · Productivity · Automation

81,816

Your Chief Agent Operator — build, schedule, and collaborate with an entire AI team in one self-hostable workspace.

View details
92
Repo Health
81
Technical
72
Dependency
Built with
TypeScript99%
Updated today
JavaScript
81%
MIT

localforge

AI Code Assistants · AI Agents · Developer Tools

396

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.

View details
46
Repo Health
54
Technical
72
Dependency
Built with
JavaScript81%
CSS12%
Updated 1 years ago
Go
54%
Other

Multica

AI Assistants · AI Development

46,769

Turn coding agents into real teammates — assign issues, track progress, and compound reusable skills across a vendor-neutral, self-hosted platform.

View details
86
Repo Health
83
Technical
70
Dependency
Built with
Go54%
TypeScript41%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search