Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Uninstall XQuartz.app from OSX Yosemite/El Capitan/Sierra
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 && \
rm -rf ~/.serverauth* && rm -rf ~/.Xauthorit* && rm -rf ~/.cache && rm -rf ~/.rnd && \
rm -rf ~/Library/Caches/org.macosforge.xquartz.X11 && rm -rf ~/Library/Logs/X11
@owlboy

This comment has been minimized.

Copy link

owlboy commented Nov 3, 2016

Great!

@mac-n-cheese

This comment has been minimized.

Copy link

mac-n-cheese commented Dec 18, 2016

Help! I'm not code savvy. Does this code apply only to XQuartz.app downloaded from macosforge.org? It's not working for me as is. Terminal responds: 'No receipt for 'org.macosforge.xquartz.pkg' found at '/'. I downloaded from xquartz.org, not Macosforge. Name of package I downloaded is just xquartz.pkg. Can I substitute org.macosforge with org.xquartz?

@pwnsdx

This comment has been minimized.

Copy link
Owner Author

pwnsdx commented Mar 1, 2017

@owlboy: Thanks!

@mac-n-cheese: Yes you can but I believe org.macosforge.xquartz.pkg is the only pkg name available.

@mattoo

This comment has been minimized.

Copy link

mattoo commented Mar 22, 2017

hello, thanks for the code !!

My Mac says "Forgot package 'org.macosforge.xquartz.pkg' on '/'." is that a big deal ?

thanks again ;)

ps: after checking, my /opt folder has reduced from 130Go to OGo... which sounds quite good ^^

@aisk

This comment has been minimized.

Copy link

aisk commented Mar 28, 2017

Hi i think rm ~/.cache is not a good idea, since some other software was using this path as cache folder (like bower and more, but i don't know now since it was deleted by this gist).

@pwnsdx

This comment has been minimized.

Copy link
Owner Author

pwnsdx commented Apr 19, 2017

hello, thanks for the code !!
My Mac says "Forgot package 'org.macosforge.xquartz.pkg' on '/'." is that a big deal ?
thanks again ;)
ps: after checking, my /opt folder has reduced from 130Go to OGo... which sounds quite good ^^

Sure no problem.

The fact that he forgot the package actually means it has been uninstalled.

Hi i think rm ~/.cache is not a good idea, since some other software was using this path as cache folder (like bower and more, but i don't know now since it was deleted by this gist).

Maybe, I'll have to reinstall it to see which directory XQuartz use inside ~/cache which I probably won't do. Anyway it's just cache files so.

@ryenus

This comment has been minimized.

Copy link

ryenus commented Dec 13, 2017

@pwnsdx, probably only ~/.cache/fontconfig/ and ~/.cache/fontforge/.

@kmbuki

This comment has been minimized.

Copy link

kmbuki commented Jun 10, 2018

Perfecto 👍

@Burkehaven

This comment has been minimized.

Copy link

Burkehaven commented Sep 26, 2018

Thanks for this.

@andalike

This comment has been minimized.

Copy link

andalike commented Oct 19, 2018

Thanks

@jabalazs

This comment has been minimized.

Copy link

jabalazs commented Dec 18, 2018

Thank you!

@asha23

This comment has been minimized.

Copy link

asha23 commented Dec 19, 2018

Great, worked perfectly thanks... It's not nice not being able to easily uninstall something you no longer need from your computer.

@helio-silva

This comment has been minimized.

Copy link

helio-silva commented Jan 28, 2019

Thanks, very useful

@xasapakos

This comment has been minimized.

Copy link

xasapakos commented Jun 19, 2019

Hi! I have a great problem. I updated the XQuartz to 2.7.11 in my MacOs Mojave and all other related software (primarily freesurfer) stopped working. I need to remove XQuartz and then install a previous version which worked. The above-mentioned script does not apply to Mojave.. Any ideas???

@ghost

This comment has been minimized.

Copy link

ghost commented Aug 13, 2019

I used the script on Mojave and it seams like everything is gone and everything is working fine. Thanks you very much!

@gp42

This comment has been minimized.

Copy link

gp42 commented Sep 20, 2019

👍

@jeffoman

This comment has been minimized.

Copy link

jeffoman commented Oct 14, 2019

same as FelixQuehi.
Thanks !

@barbhackk

This comment has been minimized.

Copy link

barbhackk commented Oct 17, 2019

Hi,
Before I used Xquartz for Inkscape. The version 1.0 Beta of Inkscape now works natively on macOS Catalina. To uninstall Xquartz it's almost the same thing.

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  && \
rm -rf ~/.Xauthorit* && rm -rf ~/.cache && \
rm -rf ~/Library/Caches/org.macosforge.xquartz.X11 && rm -rf ~/Library/Logs/X11
@webmaster128

This comment has been minimized.

Copy link

webmaster128 commented Jan 10, 2020

The only difference between the original version and @barbhackk's version is that the later does not delete ~/.serverauth* and ~/.rnd. I did not do the research if those files strictly belong to X11, but as far as I can see, the original command does the job.

Did you remove those file from the list because you use a different shell than bash (e.g. zsh)? In zsh this fails for file patterns with no match:

rm -rf ~/.serverauth*
zsh: no matches found: /Users/simon/.serverauth*

However, this works fine in bash.

@pegues

This comment has been minimized.

Copy link

pegues commented Jan 31, 2020

Thanks @barbhackk, your script worked great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.