XQuartz cannot start on macOS Mojave 10.14.5
Recently the XQuartz cracked after I open it from the Utilities folder. And I try to install it through different methods like the pkg and "brew cask install xquartz". However, it cannot work by each method.
Now I open it from the Terminals, it can open. However, it cannot open display automatically.
After I install the Grace, the problem I met as follows.
$ xmgrace
Can't open display
Failed initializing GUI, exiting
Then I tried to use "echo $DISPLAY" to show the display setup, it gives nothing.
$ echo $DISPLAY
I tried to open the Xquartz program and use another program which needs the graphics platform, it gives the error report as follows:
$ kfmf
dyld: Library not loaded: /opt/X11/lib/libxcb.1.dylib
Referenced from: /usr/bin/xwininfo
Reason: no suitable image found. Did find:
/opt/X11/lib/libxcb.1.dylib: code signature in (/opt/X11/lib/libxcb.1.dylib) not valid for use in process using Library Validation: mapping process is a platform binary, but mapped file is not /opt/X11/lib/libxcb.1.dylib: stat() failed with errno=1
Xinfo: Subscript out of range.
I want to know how to solve this problem. Please give me some advice. Thanks a lot.
This problem can be fixed by reinstall the OS system. If you have the same problem, you can use this method. And I find that the "xinfowin" program in /usr/bin folder is installed repeatedly. The old one cannot run. Then I decided to reinstall my OS system.
I guess the original problem was solved by the author by reinstalling the OS, but this seems similar to a problem I was having which seems to be the result of different versions of XQuartz (and maybe MacPorts' x11) getting in each other's way, particularly due to restrictions involving code signing security, possibly due to my not properly uninstalling one of them before reinstalling.
I seem to have fixed my issue by completely uninstalling XQuartz following instructions at the XQuartz Mailing List FAQ. A key seems to be logging out and logging back in again to make whatever magic happens that sets the $DISPLAY environment properly. I did this after uninstalling everything, and then again after installing what I wanted.
I uninstalled both 2.7 and 2.8. Running the commands if either is already uninstalled should not cause any issues beyond a warning that the resource does not exist.
Uninstall (XQuartz 2.8 and later)
To uninstall XQuartz 2.8 and later, execute the following in Terminal:
launchctl unload /Library/LaunchAgents/org.xquartz.startx.plist
sudo launchctl unload /Library/LaunchDaemons/org.xquartz.privileged_startx.plist
sudo rm -rf /opt/X11* /Library/Launch*/org.xquartz.* /Applications/Utilities/XQuartz.app /etc/*paths.d/*XQuartz
sudo pkgutil --forget org.xquartz.pkg
Uninstall (XQuartz 2.7.x and earlier)
To uninstall XQuartz 2.7.x and earlier, execute the following in Terminal:
launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist
sudo rm -rf /opt/X11* /Library/Launch*/org.macosforge.xquartz.* /Applications/Utilities/XQuartz.app /etc/*paths.d/*XQuartz
sudo pkgutil --forget org.macosforge.xquartz.pkg
At that point (after logging out and logging back in) I only installed the x11 software using MacPorts (via sudo port install xorg
) and things seem to be working again (after logging out and logging back in).
I am still trying to figure out why, in one user account, Mojave is VERY slow to launch /Applications/MacPorts/X11.app from the Finder and VERY VERY VERY slow to launch x11 when invoking 'xclock' or 'xterm' from the terminal, while in the other user account, X11.app launches much quicker (while still pretty slow).