How to make Dia (which uses X11 / XQuartz) work?

When installing Dia, either through brew install dia or downloading the DMG from the Dia site, I could run it once. On the second run, I got this:

(dia-bin:5065): Gtk-WARNING **: cannot open display: /private/tmp/com.apple.launchd.uyECihtczT/org.macosforge.xquartz:0

and Dia won't run.

I don't know how MacOS / X11 integration works, and why it would start once but not after.

I tried to follow some ideas by altering the dia launching script as described here, but MacOS, being cleverer than needed, doesn't let me run it as the app's files are signed.

How can I fix this and allow MacOS to run it?


Solution 1:

This Q & A helped: Dia command line not working

In short:

  1. Copy the script to avoid MacOS preventing running it because of signature mismatch.

  2. Add these 2 lines just before the exec line:

    export DISPLAY=:0           # Fixes the "cannot open display".
    export LANG="en_US.UTF-8"   # Fixes the annoying Xterm window opening.
    
    exec "$CWD/dia-bin" --integrated
    
  3. Run it from a command-line (or make a shortcut to taskbar, if you know how)

    /Applications/Dia.app/Contents/Resources/bin/dia2