Launchd PATH issue with TeamCity

192 views Asked by At

I recently asked this question, and got everything working appropriately. The build agent is launching, RAM disk is being created.

It seems that there is an issue with the PATH environment variable. When I run the same command from terminal, all my builds build fine. When it is launched from launchd, I get errors like "can not find mono" or "can not find nuget" both of those paths are environment variables.

How can I modify the PATH variable for a launchd file?

Here is my Launch Agent:

<?xml version="1.0" encoding="UTF-8"?>
<!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>com.datafinch.teamcity</string>
        <key>Program</key>
        <string>/Users/administrator/startup.sh</string>
        <key>RunAtLoad</key>
        <true/>
        <key>AbandonProcessGroup</key>
        <true/>
    </dict>
</plist>

And here is the script startup.sh

#!/bin/bash

setenv PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands

DISK=`/usr/bin/hdiutil attach -nobrowse -nomount ram://16777216`

/usr/sbin/diskutil erasevolume HFS+ "RamDiskCache" $DISK


/Users/administrator/buildAgent/bin/agent.sh start

When I set the PATH explicitly in my startup.sh it still doesnt work.

0

There are 0 answers