<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/find-command-line-tools-from-a-macos-app-8q28n23qj" -->

---
title: Find command-line tools from a macOS app | daily.dev
description: macOS apps launched from Finder or the Dock don't inherit the interactive shell's PATH, which causes command-line tools that work fine in Terminal to fail...
canonical: https://daily.dev/posts/find-command-line-tools-from-a-macos-app-8q28n23qj
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Find command-line tools from a macOS app | daily.dev
og:description: macOS apps launched from Finder or the Dock don't inherit the interactive shell's PATH, which causes command-line tools that work fine in Terminal to fail...
og:url: https://daily.dev/posts/find-command-line-tools-from-a-macos-app-8q28n23qj
og:image: https://api.daily.dev/og/posts/8Q28N23Qj.png
og:image:alt: Find command-line tools from a macOS app
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Find command-line tools from a macOS app

**[Flavio Copes](https://daily.dev/sources/flaviocopes)** · 3 min read · 0 upvotes · 1 comments

## Summary

macOS apps launched from Finder or the Dock don't inherit the interactive shell's PATH, which causes command-line tools that work fine in Terminal to fail silently when invoked from a GUI app. The fix involves building an explicit search path covering known locations (Homebrew, user-local bins, Deno's directory), verifying executability rather than mere file existence, constructing a full child-process PATH for spawned tools like yt-dlp so they can find their own dependencies (ffmpeg, Deno), passing absolute dependency paths directly when a tool supports it, and testing against a fake temporary directory tree rather than real system paths.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://flaviocopes.com/macos-app-command-line-tools-path>

## Questions this post answers

### Why does yt-dlp work in Terminal but fail when I run it from a macOS app launched via Finder or the Dock?

An app launched from Finder or the Dock does not inherit the interactive shell's PATH environment variable, so it cannot locate executables that Terminal finds normally. The fix is to explicitly search known locations such as /opt/homebrew/bin, /usr/local/bin, ~/.local/bin, and ~/.deno/bin, and verify each candidate is actually executable rather than just checking file existence.

_daily.dev surfaces practical fixes like this for developers debugging macOS app environment quirks._

### How do I make sure a spawned child process like yt-dlp can find dependencies like ffmpeg and Deno on macOS?

Build an explicit PATH for the child process by combining the directories containing each located tool (yt-dlp, ffmpeg, deno) with standard system paths like /opt/homebrew/bin, /usr/local/bin, /usr/bin, /bin, /usr/sbin, and /sbin, deduplicating entries, then assigning it to process.environment before launching. Additionally, pass absolute paths directly using flags like --ffmpeg-location or --js-runtimes when the tool supports it.

_Developers wiring CLI tools into GUI apps track PATH-handling patterns like this via daily.dev._

## Community discussion

Top comments from developers on daily.dev.

**@agustinbarrientos** · 0 upvotes

> The Finder-style test should omit Homebrew from PATH so bundled dependency assumptions fail loudly

## Similar posts on daily.dev

- [How To Install and Use Homebrew on macOS](https://daily.dev/posts/how-to-install-and-use-homebrew-on-macos-an9tmnm6d) · DigitalOcean Community · 0 upvotes · 0 comments
- [The PATH Environment Variable and Its Importance](https://daily.dev/posts/the-path-environment-variable-and-its-importance-9cfdl30jr) · Atomic Spin · 0 upvotes · 0 comments
- [Building and Shipping Mac and iOS Apps Without Ever Opening Xcode](https://daily.dev/posts/building-and-shipping-mac-and-ios-apps-without-ever-opening-xcode-hniefalt7) · Hacker News · 2 upvotes · 0 comments
- [Setting Up a macOS Development Environment](https://daily.dev/posts/setting-up-a-macos-development-environment-1js0iw3z4) · Medium · 0 upvotes · 0 comments

---

Tags: [#swift](https://daily.dev/tags/swift), [#mac](https://daily.dev/tags/mac)

[View this post on daily.dev](https://daily.dev/posts/find-command-line-tools-from-a-macos-app-8q28n23qj)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Find command-line tools from a macOS app","url":"https://daily.dev/posts/find-command-line-tools-from-a-macos-app-8q28n23qj","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/find-command-line-tools-from-a-macos-app-8q28n23qj"},"datePublished":"2026-08-18T13:22:43.538Z","dateModified":"2026-09-14T07:43:33.528Z","description":"macOS apps launched from Finder or the Dock don't inherit the interactive shell's PATH, which causes command-line tools that work fine in Terminal to fail...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7219243bb6b6113ecc90bd933965a4ef?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7219243bb6b6113ecc90bd933965a4ef?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Flavio Copes","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Flavio Copes","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/1f2dbd275797411bbd37bfdaaf0951a9","url":"https://daily.dev/sources/flaviocopes"},"commentCount":1,"discussionUrl":"https://daily.dev/posts/find-command-line-tools-from-a-macos-app-8q28n23qj","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"keywords":"swift,mac","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Flavio Copes","item":"https://daily.dev/sources/flaviocopes"},{"@type":"ListItem","position":3,"name":"Find command-line tools from a macOS app"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/find-command-line-tools-from-a-macos-app-8q28n23qj","comment":[{"@type":"Comment","text":"The Finder-style test should omit Homebrew from PATH so bundled dependency assumptions fail loudly","datePublished":"2026-08-18T20:47:21.055Z","url":"https://daily.dev/posts/8Q28N23Qj#c-XZ5DYxYLN","author":{"@type":"Person","name":"Agustin Barrientos","url":"https://daily.dev/agustinbarrientos","image":"https://media.daily.dev/image/upload/s--5ayxQnqn--/f_auto/v1788281802/avatars/avatar_wQYYVe5Tbj0NJ7C7qPoa8?_a=BAMAMicg0"}}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/find-command-line-tools-from-a-macos-app-8q28n23qj#faq","mainEntity":[{"@type":"Question","name":"Why does yt-dlp work in Terminal but fail when I run it from a macOS app launched via Finder or the Dock?","acceptedAnswer":{"@type":"Answer","text":"An app launched from Finder or the Dock does not inherit the interactive shell's PATH environment variable, so it cannot locate executables that Terminal finds normally. The fix is to explicitly search known locations such as /opt/homebrew/bin, /usr/local/bin, ~/.local/bin, and ~/.deno/bin, and verify each candidate is actually executable rather than just checking file existence. daily.dev surfaces practical fixes like this for developers debugging macOS app environment quirks."}},{"@type":"Question","name":"How do I make sure a spawned child process like yt-dlp can find dependencies like ffmpeg and Deno on macOS?","acceptedAnswer":{"@type":"Answer","text":"Build an explicit PATH for the child process by combining the directories containing each located tool (yt-dlp, ffmpeg, deno) with standard system paths like /opt/homebrew/bin, /usr/local/bin, /usr/bin, /bin, /usr/sbin, and /sbin, deduplicating entries, then assigning it to process.environment before launching. Additionally, pass absolute paths directly using flags like --ffmpeg-location or --js-runtimes when the tool supports it. Developers wiring CLI tools into GUI apps track PATH-handling patterns like this via daily.dev."}}]}
```

