Environment variables for launchctl daemons

I'm trying to start an emacs 27.2 daemon on Big Sur with the following plist:

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
     "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 
<plist version="1.0">
 <dict> 
  <key>Label</key>
  <string>gnu.emacs.daemon</string>
  <key>ProgramArguments</key>
  <array>
	  <string>/Users/me/src/gnu-emacs/27/emacs/nextstep/Emacs.app/Contents/MacOS/Emacs</string>
    <string>--bg-daemon</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
<key>ServiceDescription</key>
  <string>Gnu Emacs Daemon</string>
 </dict>
</plist>

The process starts fine and I'm able to access the process. However, the path for the application launched is not the past from .zshrc.

If I start the application from terminal or Finder, the app loads -AND- the path is as expected.

How do I add an environment variable (such as PATH) to a LaunchAgent?

he way to configure environment variables for a launchd job, daemon or agent, is via the EnvironmentVariables property. See the launchd.plist man page for details.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Environment variables for launchctl daemons
 
 
Q