Skip to content

Instantly share code, notes, and snippets.

@niw
Last active April 19, 2024 14:28
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niw/00643439777d9f99507d21bb671d9f33 to your computer and use it in GitHub Desktop.
Save niw/00643439777d9f99507d21bb671d9f33 to your computer and use it in GitHub Desktop.
A simple XQuartz uninstall script
#!/usr/bin/env bash
set -e
[[ $USER == "root" ]] || {
echo "You must be root to run this script." >&2
exit 1
}
echo "Unload launchd daemons and agents..."
[[ -e /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist ]] && \
launchctl unload -w /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist
[[ -e /Library/LaunchAgents/org.macosforge.xquartz.startx.plist ]] && \
launchctl unload -w /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
echo "Remove installed files..."
rm -rf /opt/X11
rm -rf /Applications/Utilities/XQuartz.app
rm -f /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist
rm -f /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
rm -f /private/etc/manpaths.d/40-XQuartz
rm -f /private/etc/paths.d/40-XQuartz
# This may be by `/usr/libexec/x11-select`.
# Symbolic links in `/usr` are SIP protected and by default exist.
rm -f /private/var/select/X11
echo "Please check your /etc/ssh/sshd_config and /etc/ssh/ssh_config and remove any unnecessary XAuthLocation configuration."
echo "There are extra lines added by installer at the very end of each file."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment