In this article
Identify which command is missing
Read the error message before editing the job. Is the missing name the program launchd should start, an interpreter named in a script’s first line, or a command called halfway through the script? Those are different lookup points.
In the Terminal session where the command works, run command -v node, or substitute the exact failing tool. An absolute executable path is useful evidence. If the result describes an alias or shell function, that convenience is not an executable that launchd can automatically reproduce. Find the underlying program and its required arguments.
Apple’s Terminal environment guide explains that a program launched by a shell inherits exported environment variables from that shell. A separately launched background job is not a child of the Terminal window in which you tested the command. Success there establishes that one execution context works.
| Failure point | Useful check |
|---|---|
| launchd cannot start the configured executable | Inspect Program and ProgramArguments |
| A running script reports a missing child command | Inspect that script’s PATH and the child’s location |
/usr/bin/env cannot find an interpreter | Inspect the job’s PATH used for interpreter lookup |
| The script starts but cannot open a data file | Inspect file paths and working directory separately |
If there is no evidence that the job started at all, begin with LaunchAgent registration versus execution. A plist on disk is not proof of a successful run.
Separate the first executable from its children
For a user-owned job, an explicit absolute executable path makes the starting point clear. In ProgramArguments, keep the executable and each argument as separate array entries. A single string containing an entire Terminal command line is not the same thing as an argument array.
Apple’s archived launchd configuration guide shows the program-and-arguments structure. Also consult man launchd.plist on the Mac running the job: the current manual documents Program as an absolute path and distinguishes the search used when that key is omitted.
On our test Mac, the manual says a relative first element of ProgramArguments, when Program is absent, is resolved using _PATH_STDPATH. Do not assume that setting a child-process PATH is the same as specifying the initial executable. Using the verified absolute path avoids that ambiguity.
An explicit /bin/sh at the start of the job does not solve every subsequent lookup. If the script later runs node, the shell still needs to find node. Likewise, #!/usr/bin/env node asks env to locate an interpreter by name. Inspect each layer implicated by the actual error.
What four one-shot jobs showed
On November 6, 2026, we created a small executable named vaultdog-path-probe in our research directory. It only printed a marker. Four disposable user LaunchAgents each started /bin/sh with a test script on macOS 15.7.5, Apple Silicon.
| Job configuration | Observed result |
|---|---|
| No job-specific PATH; script called the tool by name | PATH was /usr/bin:/bin:/usr/sbin:/sbin; command lookup failed; exit 127 |
| Job-specific PATH included the tool’s directory | The marker printed; exit 0 |
| No job-specific PATH; script called the tool by its full path | The marker printed; exit 0 |
PATH contained a literal $HOME/... entry | The printed PATH still contained $HOME; the tool was not found; exit 127 |
All four jobs loaded successfully and ran once. We removed their registrations afterward and verified their absence. We did not change the session-wide environment, system launch services, installed tools or existing jobs.
This test shows why a successful load and a failing command can coexist. It also supplies two bounded repairs: name the executable explicitly, or include its directory in that job’s search path. The observed default PATH belongs to this test context; inspect your own job instead of treating it as a universal configuration promise.
For missing or empty output files, use the separate LaunchAgent log diagnosis. Adding PATH cannot prove that logging destinations are correct.
Set only the environment the job needs
For a script with several external commands, a job-specific PATH can be easier to maintain than many full paths. The EnvironmentVariables dictionary in the plist contains variable names with string values. A PATH value is a colon-separated list of directories.
For example, if you verified that the needed executable lives in /opt/homebrew/bin, a possible value is /opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin. This is an example, not a path to paste blindly. Homebrew’s official FAQ documents different default installation prefixes, including /opt/homebrew on Apple Silicon and /usr/local on Intel. Custom installations and version managers require their own inspection.
Enter the complete intended value. Do not expect $PATH or ~ written into a plist string to behave like a command typed into your interactive shell. In our test, the $HOME text was retained literally. Keep secrets out of public diagnostic output and avoid copying an entire environment dump into a bug report.
Editing .zshrc is also not a general launchd fix. The zsh startup-file documentation separates interactive-shell files from login-shell files. A job does not automatically launch your usual interactive shell, and even an explicitly launched shell reads files according to its invocation mode.
Reload and verify the job you own
Save a backup before editing your own plist. Check its syntax with plutil -lint "/path/to/job.plist". A successful syntax check confirms that the plist parses; it does not validate the executable, environment or task outcome.
A running or registered job can still reflect an earlier configuration. After confirming that the task is safe to stop and repeat, reload that specific user job through launchctl. For an illustrative label local.example.task, the removal target is launchctl bootout "gui/$(id -u)/local.example.task"; registration uses launchctl bootstrap "gui/$(id -u)" "/path/to/job.plist". Substitute the actual Label and file, and check each result before continuing. A RunAtLoad job can execute immediately on registration.
Do not apply this example to an unfamiliar vendor helper or system daemon. For those, use the developer’s supported repair path. The background-item identification guide helps establish ownership first.
Finally, repeat the intended task and inspect its new output and exit status. Confirm the real outcome, not just the disappearance of one error line. If the executable now starts but a file remains inaccessible, investigate that separate failure with its exact path and execution context.


