xcowsay
xcowsay copied to clipboard
(xcowsay:98214): Gtk-WARNING **: 19:50:34.517: cannot open display
I did clone and build the xcowsay app and installed xquartz on a MacBook running OSX 11.6 (Big Sur).
I can run other apps using xquartz like xcalc or xterm or xclock, but when I run xcowsay I get the following message
(xcowsay:98077): Gtk-WARNING **: 19:49:49.479: cannot open display: /private/tmp/com.apple.launchd.HS5DGKsS3t/org.xquartz:0
Any guess on what is wrong?
No good ideas unfortunately. But the other programs you mention above are all using X11 directly whereas xcowsay is actually a Gtk app. Do you get the same error with other Gtk programs (e.g. gedit?).
I'm pretty sure xcowsay used to work on macOS at some point. You might like to try the older Gtk2 version too (the v1.4 tag).
This is because Gtk on macOS can use either the native backend or X11. Commenting this line resolves it:
https://github.com/nickg/xcowsay/blob/e6a1c464d9045668a046a5990624263c19d8ec6b/src/display_cow.c#L161
However, because the app does not use GApplication, the window is shown in the background and you have to click the icon in the dock to reveal it.