title: Is there a way to run GUI application in a headless way in Mac?
body: <p>I'm using following techniques to run GUI application in Linux and Windows:</p>
  
  <p><strong>Linux:</strong></p>
  
  <pre><code>:~$ Xvfb :99 -ac &amp;
  :~$ DISPLAY=:99 ./app
  </code></pre>
  
  <p>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.</p>
  
  <p><strong>Windows (programmatic way):</strong></p>
  
  <pre><code>HDESK hDesk=CreateDesktop(TEXT("Virtual"),NULL,NULL,NULL,GENERIC_ALL,NULL);
  if(hDesk!=NULL) {
     // create process in this desktop
     CloseDesktop(hDesk);
  }
  </code></pre>
  
  <p><strong>Mac OS X:</strong></p>
  
  <p>How do I do the same in Mac OS X (either from command line or in a programmatic way)?
  Thanks!</p>