7

I'm using following techniques to run GUI application in Linux and Windows:

Linux:

:~$ Xvfb :99 -ac &
:~$ DISPLAY=:99 ./app

This won't work for 100% in Mac OS X, even though Xvfb is installed by default, since most applications run in Aqua environment, and simply ignore DISPLAY variable setting.

Windows (programmatic way):

HDESK hDesk=CreateDesktop(TEXT("Virtual"),NULL,NULL,NULL,GENERIC_ALL,NULL);
if(hDesk!=NULL) {
   // create process in this desktop
   CloseDesktop(hDesk);
}

Mac OS X:

How do I do the same in Mac OS X (either from command line or in a programmatic way)? Thanks!

Michael Spector
  • 36,723
  • 6
  • 60
  • 88
  • *(not an answer, hence the comment but...)* I know for a fact that in the past people where hacking racks full of Mac minis by soldering a diode (?) to each Mac to make it believe there was a monitor attached so that OS X thought it wasn't really "headless". I'm not sure it was the best solution back in the days but this definitely has been seen in the wild and is one of the craziest hack I've seen. – TacticalCoder Jan 25 '12 at 13:58
  • You might look at [DVI Detective](http://www.gefen.com/kvm/dproduct.jsp?prod_id=4714). – user1118321 Jan 25 '12 at 20:11
  • Did you ever find a solution to this? Was pretty excited to find Xvfb was installed by default, but it seems to be pretty useless. – Tom Christie Jul 04 '12 at 21:07
  • Looks like firefox-x11 might be the answer to your problem if it's firefox you're looking to run? (based on your comment below) – Tom Christie Jul 04 '12 at 21:17

2 Answers2

2

Is this a Java question? I don't recognize either the HDESK nor the CreateDesktop call, but in the JVM itself, you can run headless pretty much anywhere by invoking java with the headless System Property defined...

java -Djava.awt.headless=true

I've had success with this on Windows and Linux at least. I would expect it to work on OS X in the same manner. The article explains it pretty well: http://java.sun.com/developer/technicalArticles/J2SE/Desktop/headless/

Bob Kuhar
  • 10,838
  • 11
  • 62
  • 115
-1

I have the same issue, currently found two more-or-less related articles:

https://spideroak.com/faq/questions/72/how_can_i_run_spideroak_without_the_gui_from_launchd/

and

http://lists.squeakfoundation.org/pipermail/seaside/2009-August/021270.html

basically what they suggest is using

--headless  

or

-vm-display-null 

options

user133406
  • 11
  • 1
  • 3