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?
This Q &amp; A helped: Dia command line not working
In short:

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

Add these 2 lines just before the exec line:
export DISPLAY=:0           # Fixes the &quot;cannot open display&quot;.
export LANG=&quot;en_US.UTF-8&quot;   # Fixes the annoying Xterm window opening.

exec &quot;$CWD/dia-bin&quot; --integrated


Run it from a command-line (or make a shortcut to taskbar, if you know how)
/Applications/Dia.app/Contents/Resources/bin/dia2