If you are facing this error
(main:30677): Gtk-WARNING **: 05:40:47.665: cannot open display: just install Gtk+ development library, and set the display screen to 0.
Installing Gtk+ using Homebrew
If you are using a UNIX-like OS such as Mac OS X, or a Linux distribution. You can use Homebrew package manager to install Gtk+ as following.
brew install Gtk+
Install Gtk+ using apt
If you are using Debian, Ubuntu, Elementary OS, Linux Mint, .. You can use this command to install Gtk+.
sudo apt-get install libgtk-3-dev
Set DISPLAY Environment Variable
If the error persists, just run this command on terminal to set the display to the current display/monitor/screen.
If the display command fixed the error, add those lines into your
.zshrc (according to what you are using).
if [[ -z "$DISPLAY" ]] then DISPLAY=":0" export DISPLAY fi
Use X11 XQuartz on Mac
If your application still showing the same error on Mac OS, just install XQuartz from here https://www.xquartz.org and restart. Your Gtk apps will work after that.
I hope this helps. Do you recommend reading this blog post? share it!