X11
X11 implementations
There are two X11 implementations for macOS, i.e. the X.org Xquartz X server.
Web site | xquartz.org | macports.org/port/xorg-server |
Xterm tool | /Utilities/XQuartz.app | /MacPorts/X11.app |
Bundle ID | up to v2.7.11: org.macosforge.xquartz.X11 since v2.8.0: org.xquartz.X11 | org.macports.X11 |
Files which Xquartz | /opt/X11/bin/Xquartz | /opt/local/bin/Xquartz |
From Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Some details change, and there's an X11 app vs the Xquartz app but aside from various directory and file name differences (since one could install both, although would usually just have the launch daemon and launch agent for one enabled), the principles are pretty much the same.
Which is the active X11 server
$ echo $DISPLAY
/private/tmp/com.apple.launchd.NM9eYoEKhK/org.macosforge.xquartz:0 <-- Xquartz 2.7.11 (old)
/private/tmp/com.apple.launchd.xbno1VpaZe/org.xquartz:0 <-- Xquartz pour 2.8.1
/private/tmp/com.apple.launchd.J7h4bgbbAb/org.macports:0 <--- Macports.org
Switching from one implementation to the other
Macports.org
$ sudo launchctl disable system/org.xquartz.X11
$ sudo launchctl enable system/org.macports.X11
$ sudo launchctl disable user/$UID/org.xquartz.startx
$ sudo launchctl enable user/$UID/org.macports.startx
Then logout and login
Xquartz.org
$ sudo launchctl disable system/org.macports.X11
$ sudo launchctl enable system/org.xquartz.X11
$ sudo launchctl disable user/$UID/org.macports.startx
$ sudo launchctl enable user/$UID/org.xquartz.startx
Then logout and login
Testing
$ sudo launchctl print-disabled system | grep -e xquartz -e macports
"org.macports.X11" => true
"org.xquartz.X11" => false <-- the active one
"org.xquartz.privileged_startx" => false
"org.macports.startx" => false
"org.xquartz.startx" => false
$ sudo launchctl print-disabled user/$UID | grep -e xquartz -e macports
"org.macports.startx" => true
"org.xquartz.startx" => false <-- the active one
How to delete a service
Lets assume that a service "org.macports.dummy" was inadvertently created due to a typo in one of the above commands. The solution is given here:
<https://apple.stackexchange.com/questions/374495/how-to-remove-a-service-from-launchd-added-by-mistake>
$ sudo grep -rnw '/var/db/com.apple.xpc.launchd/' -e "dummy"
Password:
/var/db/com.apple.xpc.launchd//disabled.502.plist:27: <key>org.macports.dummy</key>
$ cat /var/db/com.apple.xpc.launchd//disabled.502.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.adobe.GC.AGM</key>
<false/>
<key>com.apple.ManagedClientAgent.enrollagent</key>
<true/>
<key>com.apple.Siri.agent</key>
<true/>
<key>com.microsoft.update.agent</key>
<false/>
<key>org.macports.X11</key>
<false/>
<key>com.apple.FolderActionsDispatcher</key>
<true/>
<key>com.adobe.GC.Scheduler-1.0</key>
<false/>
<key>org.xquartz.X11</key>
<false/>
<key>org.macports.startx</key>
<false/>
<key>org.xquartz.startx</key>
<true/>
<key>com.apple.appleseed.seedusaged.postinstall</key>
<true/>
<key>org.macports.dummy</key>
<true/>
</dict>
</plist>
Deleting the above two bold lines will delete the corresponding service (tested with Big Sur).