Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using Dropbox to sync files to my web site, which is running on Mac OS X Mountain Lion. Problem is, if I am not logged in, Dropbox isn't running and as a result any changes I make to my web site on another computer linked to Dropbox, the web site does not update.

I have tried to solve the problem by making Dropbox run as a daemon at startup. I created a launchd entry in /Library/LaunchDaemons using the UserName key to run Dropbox as myself, and it launches, but nothing updates. When I redirect the output of the Dropbox executable to a file, I see the following error, although it isn't obvious to me that it is fatal, and I still see Dropbox in the process list.

/Applications/Dropbox.app/Contents/Resources/lib/python2.7/lib-ol_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
2013-09-15 17:42:20.592 Dropbox[267:707] Unable to simultaneously satisfy constraints:

(
    <NSLayoutConstraint:0x5636c30 H:[_NSAlertContentView:0x56319e0(<=0)]>,
    <NSLayoutConstraint:0x5636b70 H:[_NSAlertContentView:0x56319e0(>=420)]>
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x5636c30 H:[_NSAlertContentView:0x56319e0(<=0)]>

Set the NSUserDefault NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints to YES to have -[NSWindow visualizeConstraints:] automatically called when this happens.  And/or, break on objc_exception_throw to catch this in the debugger.
2013-09-15 17:42:20.593 Dropbox[267:707] Unable to simultaneously satisfy constraints:

(
    <NSLayoutConstraint:0x5637240 V:[_NSAlertContentView:0x56319e0(<=0)]>,
    <NSLayoutConstraint:0x5637180 V:[_NSAlertContentView:0x56319e0(>=131)]>
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x5637240 V:[_NSAlertContentView:0x56319e0(<=0)]>

Set the NSUserDefault NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints to YES to have -[NSWindow visualizeConstraints:] automatically called when this happens.  And/or, break on objc_exception_throw to catch this in the debugger.
2013-09-15 17:42:20.612 Dropbox[267:707] Error (1000) creating CGSWindow on line 259
2013-09-15 17:42:20.614 Dropbox[267:707] (
0   CoreFoundation                      0x98598e8b __raiseError + 219
1   libobjc.A.dylib                     0x987e152e objc_exception_throw + 230
2   CoreFoundation                      0x98598d21 -[NSException raise] + 17
3   _objc.so                            0x02b30b2f PyObjCErr_ToObjCWithGILState + 63
4   _objc.so                            0x02b11501 PyObjCFFI_BuildResult + 4673
5   _objc.so                            0x02b0254f ffi_closure_SYSV_inner + 127
6   _objc.so                            0x02b02352 ffi_closure_SYSV + 34
7   libobjc.A.dylib                     0x987ee5d3 -[NSObject performSelector:withObject:] + 70
8   Foundation                          0x90d9d326 __NSThreadPerformPerform + 395
9   CoreFoundation                      0x9846f04f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
10  CoreFoundation                      0x9846ea79 __CFRunLoopDoSources0 + 233
11  CoreFoundation                      0x98494826 __CFRunLoopRun + 934
12  CoreFoundation                      0x9849401a CFRunLoopRunSpecific + 378
13  CoreFoundation                      0x98493e8b CFRunLoopRunInMode + 123
14  HIToolbox                           0x9107af5a RunCurrentEventLoopInMode + 242
15  HIToolbox                           0x9107acc9 ReceiveNextEventCommon + 374
16  HIToolbox                           0x9107ab44 BlockUntilNextEventMatchingListInMode + 88
17  AppKit                              0x9907693a _DPSNextEvent + 724
18  AppKit                              0x9907616c -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 119
19  AppKit                              0x9906c5cc -[NSApplication run] + 855
20  _objc.so                            0x02b022ad ffi_call_SYSV + 29
21  _objc.so                            0x02b025c9 ffi_call + 89
22  _objc.so                            0x02b1b2e9 PyObjCFFI_Caller + 2809
23  _objc.so                            0x02b4006a PyObjCSelector_GetClass + 698
24  Python                              0x02209918 PyObject_Call + 88
25  Python                              0x022be2cf PyEval_EvalFrameEx + 5663
26  Python                              0x022c4571 PyEval_EvalCodeEx + 2081
27  Python                              0x022c20d3 PyEval_EvalFrameEx + 21539
28  Python                              0x022c4571 PyEval_EvalCodeEx + 2081
29  Python                              0x022c20d3 PyEval_EvalFrameEx + 21539
30  Python                              0x022c4571 PyEval_EvalCodeEx + 2081
31  Python                              0x0223b3d2 PyClassMethod_New + 1138
32  Python                              0x02209918 PyObject_Call + 88
33  Python                              0x022bea8c PyEval_EvalFrameEx + 7644
34  Python                              0x022c4571 PyEval_EvalCodeEx + 2081
35  Python                              0x022c20d3 PyEval_EvalFrameEx + 21539
36  Python                              0x022c2fb2 PyEval_EvalFrameEx + 25346
37  Python                              0x022c2fb2 PyEval_EvalFrameEx + 25346
38  Python                              0x022c2fb2 PyEval_EvalFrameEx + 25346
39  Python                              0x022c4571 PyEval_EvalCodeEx + 2081
40  Python                              0x022c46f7 PyEval_EvalCode + 87
41  Python                              0x022e8fa5 PyRun_SimpleFileExFlags + 789
42  Python                              0x022e90f8 PyRun_SimpleFile + 40
43  Dropbox                             0x000067f1 start + 17777
44  Dropbox                             0x00006f89 main + 1481
45  Dropbox                             0x00002382 start + 258
46  Dropbox                             0x000022a9 start + 41

`

share|improve this question
    
Is there some reason you don't create a separate user just for this purpose and leave that account logged in? –  ckhan Sep 16 '13 at 1:11
    
this machine is shared with other users and the machine sometimes gets restarted when i am not around, in which case the other account wouldn't get logged on (and it would be annoying to the other users as well as a security hole to have it automatically log that user on every boot) –  Michael Sep 16 '13 at 1:22
    
and by security hole that includes the 2 year old coming along and accidentally messing everything up because it automatically logged the "web" account on. –  Michael Sep 16 '13 at 1:22
1  
You can't sync with Dropbox unless you log into your account I am not sure I fully understand the question –  Ramhound Sep 16 '13 at 2:21
    
I mean log in from the GUI. I don't understand why the GUI would be necessary to run the Dropbox daemon to sync files, the GUI is a totally unrelated layer. –  Michael Sep 16 '13 at 3:16

2 Answers 2

Seems like a lot of work for something that can be accomplished with Mercurial/Git running on the target machine without logging in. With that you get the added advantage of source control.

Automatic pull from Mercurial

share|improve this answer
    
I know it's possible and done, but I would rather not keep lots of image files in version control. –  Michael Jan 28 at 18:39
    
I can appreciate that but as DVCS's like mercurial only store change sets, it'd mean you weren't pulling the full repo each time - only the changes. Plus it gives you the traceability and exact functionality you require from dropbox. Alternatively of course, could you not just FTP direct to the server? –  ScottMcGready Jan 29 at 1:23

The "Error (1000) creating CGSWindow on line 259" shows that the internal Python app needs some form of graphical interface needed (perhaps the flash screen or the menu pop-up). By default, the LaunchAgents/Daemons don't have graphical access, it might not even be activated yet.

From the launchctl man page:

Currently known session types include: Aqua, LoginWindow, Background, StandardIO and System.

In launchd plist file, try adding the LimitLoadToSessionType requirement of "Aqua" and "LoginWindow" session type.

<key>LimitLoadToSessionType</key>
  <array>
    <string>LoginWindow</string>
    <string>Aqua</string>
  </array>

Beware, that an app will probably be quit and restarted when logging in. From the Apple Daemon technote:

If you set LimitLoadToSessionType to an array, be aware that each instance of your agent runs independently. For example, if you set up your agent to run in LoginWindow and Aqua, the system will first run an instance of your agent in the loginwindow context. When a user logs in, that instance will be terminated and a second instance will launch in the standard GUI context.

share|improve this answer
    
thanks, I'll try that as soon as I get a chance... –  Michael Jan 28 at 18:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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