fix-path

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

Library
npm
v5.0.0
300 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
36 /100 Needs Attention
Development Activity 0
Maintenance 20
Community 44
Maturity 60
Momentum 20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
69 /100 Good
Architecture 55
Code Quality 70
Innovation 60
Learning Curve 90

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

33,179

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
85
Repo Health
76
Technical
66
Dependency
Built with
TypeScript 95%
Updated 1 months ago
JavaScript
95%
MIT

AnythingLLM

AI Assistants · Automation · Developer Tools

66,533

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

View details
90
Repo Health
78
Technical
64
Dependency
Built with
JavaScript 95%
Updated 1 weeks ago
TypeScript
96%
Other

Dyad

AI Assistants · AI Code Assistants · AI Development

21,616

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

View details
88
Repo Health
83
Technical
69
Dependency
Built with
TypeScript 96%
Updated 1 weeks ago
TypeScript
99%
Other

LobeHub

AI Assistants · Automation · Productivity

82,864

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
66
Dependency
Built with
TypeScript 99%
Updated 1 weeks ago
JavaScript
81%
MIT

localforge

AI Agents · AI Code Assistants · Developer Tools

399

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
73
Dependency
Built with
JavaScript 81%
CSS 12%
Updated 1 years ago
Go
56%
Other

Multica

AI Assistants · AI Development

51,481

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

View details
87
Repo Health
83
Technical
67
Dependency
Built with
Go 56%
TypeScript 38%
Updated 1 weeks ago

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