4

XQuartz stopped working after having worked fine for a long time. I checked some obvious things like my $PATH to see if something stepped on it but didn't find any discernible difference from what I had previously.

$ echo $PATH /usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/usr/X11/bin:/usr/local/opt/python/libexec/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin

So, after looking at what seems like a million suggestions I uninstalled with the commands listed at: https://gist.github.com/pwnsdx/d127873e24cef159d4d603accaf37ee4

After reinstalling with XQuartz-2.7.11.dmg I try launching XQuartz.app by right clicking it in a finder window but it doesn't launch. The only indication of a problem I can see is when launching the XQuartz.app I get the following:

$ tail -f /private/var/log/system.log | grep xquartz Jan 5 17:26:33 bos-mpx3u com.apple.xpc.launchd[1] >(org.macosforge.xquartz.X11.24980[2612]): Service exited with abnormal code: 126

So, I've tried uninstalling and reinstalling XQuartz-2.7.9.dmg, reinstalling XQuartz-2.7.11.dmg and even reinstalling via $ brew cask install xquartz but I always get the same results.

At this point I've burned way to much time trying to track this down. Any help is truely appreciated.

user9179484
  • 61
  • 1
  • 4

3 Answers3

4

It often hard to nail the issue with limited info. but few checkpoints as it works fine.

  • ensure your Sierra is > 10.13.x
  • reinstall xquartz cask via : brew cask reinstall xquartz
  • if needed use brew cask reinstall xquartz --force

this should give you 2.7.11

ensure that your xquartz is symlinked correctly. it should be in your apps folder. refer to this:

brew linkapps for homebrew casks (automatically create symlink to /Applications folder)

hope that helps. I tested and works fine.

other things to check include

  • in your terminal shell (bash), find the executable bin of xquartz
$ which xquartz
  • if it does/might not exist but it should be in /opt/X11/bin/xquartz
  • now either (1) ensure that /opt/X11/bin/ is in your path by export PATH="/opt/X11/bin:$PATH" or (2) create a symlink for xquartz from /usr/local/bin/xquartz to /opt/X11/bin/xquartz .

this will link up your xquartz correctly or at least its in your accessible binary. Some applications will read only environment variables that determines where xquartz so check the documentation of the apps and what they expect in terms of environment variables. If you are curious, just type env or printenv in your shell to spit out your env vars for current session.

mirageglobe
  • 2,446
  • 2
  • 24
  • 30
  • Thanks, my apologies for the lack of information provided by the log files ;-). I did try your suggestions although I'm running Sierra 10.12.6. If there are any other checkpoints I can examine please let me know. I've gone as far as looking at the actual apps launched from the xquartz.app bundle but still haven't been able to uncover anything. – user9179484 Jan 29 '18 at 16:20
  • Hi.. seems like the issue is similar to as described https://apple.stackexchange.com/questions/247365/el-capitan-xquartz-fails-to-open-abnormal-code-126 you might see the issue in that case was tcsh which was solved by linking tcsh. Your case can be quite different so will need to examine your logs right after reboot the author tried to relink it $sudo ln -s /bin/tcsh tcsh – mirageglobe Feb 09 '18 at 00:16
  • Unfortunately this didn't work although I believe its on the right line. It seems to be PATH or shell related. – user9179484 Feb 12 '18 at 22:00
  • 1
    The command `brew cask reinstall xquartz --force` worked for me. I guess this is because it fixes the launchctl issue. **Reboot in order to reset** otherwise you will get a _Can't open display_ error. (There might be a way to relaunch it without reboot, but I have not tried.) – fralau Apr 02 '19 at 06:35
2

I found the following solution to the issue at https://docs.brew.sh/FAQ.html.

Question: My Mac .apps don’t find /usr/local/bin utilities!
Answer: GUI apps on macOS don’t have /usr/local/bin in their PATH by default. If you’re on Mountain Lion or later, you can fix this by running:

sudo launchctl config user path "/usr/local/bin:$PATH"

and then rebooting, as documented in man launchctl. Note that this sets the launchctl PATH for all users. For earlier versions of macOS, see this page.

Once I applied that change and rebooted all is well.

fralau
  • 3,279
  • 3
  • 28
  • 41
user9179484
  • 61
  • 1
  • 4
0

Lost a few hours on this too. My "abnormal code" was 127, not 126, but otherwise the symptoms were similar. For me, it turns out the fix is quite simple:

XQuartz no longer starts if your default shell is not zsh! To fix, issue chsh -s /bin/zsh before running XQuartz.

Reference: https://github.com/XQuartz/XQuartz/issues/120#issuecomment-1183941633

Heath Raftery
  • 3,643
  • 17
  • 34