The application “XQuartz” can’t be opened

finderx11

I'm quite puzzled by the following issue. I tried to open XQuartz after some time I hadn't used it and I got a dialog box saying "The application "XQuartz" can't be opened." I went through all the usual troubleshooting steps (deleting preferences and caches, and reinstalling the application) to no avail. After further troubleshooting I discovered that:

  1. it only happens in my account; i.e., XQuartz works for other accounts on the same laptop;
  2. it only happens when trying to open XQuartz from Finder; i.e., if try to open XQuartz from the command line with xquartz or open /Applications/Utilities/XQuartz.app, XQuartz opens properly.

I suspect the issue has something to do with environment variables, possibly the PATH variable, for applications launched through Finder, but I'm not sure how to troubleshoot that. Any suggestions? I'm on macOS Catalina 10.15.7

Best Answer

The issue was my .zprofile file. I recently installed Intel oneAPI and I had the initialization script in the .zprofile file. I moved the script to the .zshrc file, and now everything works properly.