LaunchDaemons and Environment Variables

后端 未结 1 1484
孤独总比滥情好
孤独总比滥情好 2021-01-21 17:52

For a while now, I\'ve been noticing that my MacPorts-installed Apache2 instance hasn\'t been starting when I start up (MacPorts Apache2 Stopped Launching on Boot). The LaunchDa

相关标签:
1条回答
  • 2021-01-21 18:16

    I found this page about the Boot Process on MacOSX, which contains some information. Basically, launchd is started and run as root. Every daemons is then started by launchd based on the plist file.

    Regarding the environment during daemon start, I have not find a single bit of explicit information. But after reading the launchctl man, I found a command that can print out the environment of launchd. So the trick is to go root and ask:

    #$> sudo su
    Password:
    #$> whoami
    root
    #$> launchctl
    launchd% export
    PATH="/usr/bin:/bin:/usr/sbin:/sbin"; export PATH;
    launchd% exit
    #$> exit
    

    I infer that the print environment is the one used when daemons are started. If you repeat the operation without going root, the environment must match the user's one.

    0 讨论(0)
提交回复
热议问题