Incorrect environment variables when running remote agent on macOS

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

After installing the remote agent as a daemon on macOS builds start to fail because environment variables are not being picked.

Diagnosis

Create a test plan with a script task to print the environment variables:

1 2 echo $JAVA_HOME echo $PATH

Cause

By default, the macOS daemon does not pick environment variables.

Solution

There are two possible solutions for this issue. We can either set the environment variables on the plist file or at wrapper.conf:

Option A

You can set the environment variables in <Bamboo agent home>/conf/wrapper.conf, copy your JAVA_HOME and PATH and insert them in the wrapper configuration. E.g.

1 2 3 4 # Allow the service to interact with the desktop. wrapper.ntservice.interactive=FALSE set.JAVA_HOME=/path/here set.PATH=/path

Restart the service.

More information on Wrapper environment variables configuration: Environment Variable Definition

Option B

You can configure them in the plist file {{/Library/LaunchDaemons/org.tanukisoftware.wrapper.bamboo-agent.plist}} like in the example below. Add the following inside the dict:

1 2 3 4 5 6 7 <key>EnvironmentVariables</key> <dict> <key>JAVA_HOME</key> <string>/Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home</string> <key>PATH</key> <string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin</string> </dict>

Then reload the daemon:

1 2 sudo launchctl unload -w /Library/LaunchDaemons/org.tanukisoftware.wrapper.bamboo-agent.plist sudo launchctl load -w /Library/LaunchDaemons/org.tanukisoftware.wrapper.bamboo-agent.plist

Option C

You can configure them using launchctl setenv command by executing the below sample commands:

1 2 sudo launchctl setenv JAVA_HOME $JAVA_HOME sudo launchctl setenv PATH $PATH

Once the requirement environment variables are set, restart the Bamboo service. 

Updated on March 18, 2025

Still need help?

The Atlassian Community is here for you.