Setting environment variables via launchd.conf no longer works in OS X Yosemite/El Capitan/macOS Sierra/Mojave?

前端 未结 9 1381
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 08:07

It looks like the launchd.conf does not load my environment variable anymore. Has anyone else noticed that?

Is there another solution to permanently set

9条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-22 08:21

    Cited from

    Apple Developer Relations 10-Oct-2014 09:12 PM

    After much deliberation, engineering has removed this feature. The file /etc/launchd.conf was intentionally removed for security reasons. As a workaround, you could run launchctl limit as root early during boot, perhaps from a LaunchDaemon. (...)

    Solution:

    Put code in to /Library/LaunchDaemons/com.apple.launchd.limit.plist by bash-script:

    #!/bin/bash
    
    echo '
    
    
    
            Label
            eicar
            ProgramArguments
            
                    /bin/launchctl
                    limit
                    core
                    unlimited
            
            RunAtLoad
            
            ServiceIPC
            
    
    ' | sudo tee /Library/LaunchDaemons/com.apple.launchd.limit.plist
    

提交回复
热议问题