- Home /
batchbuild fail on Mac OS X in SSH login
Logged on a Mac mini with OS X and run U3D batch build command:
/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -projectPath /Users/alexq/myproject -executeMethod MyClass.BuildMyPlayer
But got an error message:
Unity[776] : kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
Answer by woebtz · Oct 19, 2012 at 05:41 AM
I don't know what the error is referring to, but I get that same "kCGErrorFailure" message over an ssh session as user1 when user1 is not actually logged into the desktop (e.g. Mac on OS X login screen).
I'm only trying to launch (and immediately quit) Unity:
$ /Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode
Thu Oct 18 20:35:07 {COMPUTER} Unity[74611] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
It seems like:
Executing the command as user1 and no users are logged in -> kCGErrorFailure, Unity process hangs indefinitely
Executing the command as user1 and user2 is logged in -> kCGErrorFailure, Unity process hangs indefinitely
Executing the command as user1 and user1 is logged in -> Unity starts and ends as expected.
What's a little odd about the headless launch is that the Unity app even pops up in the dock for a few seconds.
Yes that is the workaround I found too (i.e. log in at the server keyboard, lock it and leave). Obviously not great, but something.
Answer by dreamychris · Feb 15, 2013 at 07:46 AM
The problem is that the Unity editor requires access to the window server, since it insists on displaying a GUI even in batch mode. Thus, you can't run it from SSH directly.
I had a similar problem with my Jenkins build server. My hacky workaround was to use Applescript to launch a Terminal window and script it to run a secondary shell script (which in turns launches Unity, tails the log, launches xcodebuild, etc.). Obviously a user has to be logged in for this to work, so I also set my Mac to log in automatically at startup.
You can get fancy with output direction and tail -F to pass the log output back to SSH, which makes it mostly seamless, albeit conceptually ugly.
It works fine, but if anyone finds a nicer method I'd certainly be interested.
dreamychris,
I'm trying to do the exact same thing you're talking about, using jenkins to automate my build for iOS. Could you post your scripts?
thanks, $$anonymous$$ike
Answer by andi.radulescu · Jan 09, 2014 at 06:39 PM
You have to be logged in on the Mac Mini with the same user as the one you ssh.
Your answer
![](https://koobas.hobune.stream/wayback/20220612202212im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Running Mac Standalone Player In Batchmode 1 Answer
Unity3d crashes in batchmode from a null string 1 Answer
batchbuild fail on Mac OS X in SSH login 1 Answer
Unity and WM_QUIT 1 Answer