14

I'm trying to build Unity project with Jenkins on Mac OS Server. But when I try to run the following script

/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode ${PROJECT_PATH} -executeMethod BuildScript.DevelopmentBuild

The script shows this,

_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.

Does anyone knows how to fix the problem?

1
  • Now I fixed the problem. I moved Jenkins CI from /Library/LaunchDaemons/ to /Library/LaunchAgents/. Also I made jenkins user and install Unity3D on jenkins user. Then keep logged in jenkins user.
    – morodomi
    Sep 27, 2013 at 2:28

6 Answers 6

13

Try write from Terminal:

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
sudo mv /Library/LaunchDaemons/org.jenkins-ci.plist /Library/LaunchAgents/org.jenkins-ci.plist

Then log out and log in again.

Now Jenkins will run as agent and can access WindowServer.

2
  • 1
    I had to restart my machine after this change. Logging out and logging in wasn't enough. Also I don't have Jenkins configured to run on machine startup, so I had to run sudo launchctl load /Library/LaunchAgents/org.jenkins-ci.plist after restarting. Aug 10, 2014 at 20:13
  • Did also had to restart the machine, but after that it just worked fine! thx
    – d4Rk
    Jan 30, 2015 at 10:18
4

Make sure you have -nographics parameter among your startup parameters

1

I tried

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

sudo mv /Library/LaunchDaemons/org.jenkins-ci.plist /Library/LaunchAgents/org.jenkins-ci.plist

Then Restarted my Mac

And then sudo launchctl load /Library/LaunchAgents/org.jenkins-ci.plist after restarting

It worked

0

I had this same issue. The problem is with how Jenkins and Unity work individually. The only way I could find a cleaner work around was:

  1. Ideally have your Jenkins master only do assignments to slave and do not build anything by itself. So your slaves would build the project.
  2. In case above is not easily doable here is a quick workaround:
    • On your Jenkins master create a slave.
    • Add a label to execute your Unity project on the newly created slave.
    • Configure the job to run on dedicated slave that you created above.
    • All works now!
0

You also get this error if the user you are running as is not currently logged in graphically.

-1

It looks like you're missing the --projectPath option prior to specifying your project's path?

1
  • I tried with --projectPath option as Unity -batchmode -quit -projectPath "${UNITY_PROJECT_PATH}" -executeMethod BuildScript.DevelopmentBuild. But won't build.
    – morodomi
    Jan 16, 2013 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.