Unable to open display error (on MACs)

I just ran into this error myself while trying to run the latest compiled CellProfiler (7522, aka branch 7184) on my mac. It wouldn’t launch when I clicked on the CellProfilerForMacI.command script, and this was the Terminal output:

Warning: Unable to open display ‘:0.0’. You will not be able to display graphics on the screen.
??? Error using ==> imshow at 191
IMSHOW requires Java to run.

Warning: 1 invisible figure(s) exist at MCR termination.

If your application has terminated unexpectedly, please note that
applications generated by the MATLAB Compiler terminate when there are no
visible figure windows. See the documentation for WaitForFiguresToDie and
WAITFORCALLBACKS for more information.


[Process completed]

The fix is to comment out (or remove) the line in the .command file

In Mac OS 10.5+ (Leopard, and beyond I assume), you do not need to manually specify the DISPLAY variable, as ‘launchd’ will handle it for you.

Hope this helps,