3

I need to run an applescript that uses Finder; however, I have to run it as a user connected via ssh. So there's no UI. And the script fails with -10810 error when there's no UI.

Is there any alternative for X11's Xvfb that I could use for Mac server 10.6 to fake a display and make the script work?

Cheers!

Tomas

Edit: To explain the problem more precisely - the script works if there's a user logged in with UI (e.g., when the user that uses ssh to run the script is also logged in via VNC). However, when I only log in using ssh, the error appears. Which leads me to believe that the script needs UI to be able to use Finder.

So I guess running X11 and Xvfb on the server won't really help, because it won't allow me to run the script anyway (I need to start Finder).

Tomas Brambora
  • 153
  • 1
  • 1
  • 6

2 Answers2

10

Xvfb is not "Linux's", it's X11.

Mac OS X includes X11 support, called XQuartz (aka X11.app), installed with the system by default since version 10.5. It includes Xvfb (/usr/X11/bin/xvfb).

EDIT: Now, that you explained better what you need, it's more clear. What you want is headless setup, to run GUI apps on that you need to either setup VNC server or use Apple Remote Desktop.

vartec
  • 6,217
  • 2
  • 33
  • 49
  • You're right, I haven't explained myself correctly. Anyway, I think this won't really help - the problem is that there must be a user logged in with UI (i.e., not using ssh), otherwise the script fails. And X11 won't allow me to run finder or will it? – Tomas Brambora Feb 23 '11 at 10:50
  • 1
    As of this writing, xvfb is no longer installed by default on OSX. – meatspace Nov 16 '15 at 17:23
0

It's not just the Finder, AppleScript is really intended to control programs running within an Aqua UI session; trying to use it from a pure command-line environment (or even X11) seems doomed to failure. If you're in a command-line environment, I'd use a shell script if at all possible -- there are commands available to do pretty much anything the Finder can do.

Gordon Davisson
  • 11,216
  • 4
  • 28
  • 33