-
-
Save uchida/4632662 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
# MacTeX uninstaller script based on pkgutil command | |
# by Akihiro Uchida, CC0 dedicated to the public domain | |
# see http://creativecommons.org/publicdomain/zero/1.0/ | |
IFS=$(echo -en "\n") | |
for pkg in $(pkgutil --pkgs|grep org.tug.mactex); do | |
volume="$(pkgutil --pkg-info "$pkg"|grep volume|cut -d' ' -f2-)" | |
location="$(pkgutil --pkg-info "$pkg"|grep location|cut -d' ' -f2-)" | |
echo "remove all of the files installed under the $pkg" | |
for file in $(pkgutil --files "$pkg"); do | |
rm -rf "${volume}${location}/${file}" | |
done | |
pkgutil --forget "$pkg" | |
done | |
echo "remove TeX Distribution pane on the System Preferences.app" | |
rm -rf /Library/PreferencePanes/TeXDistPrefPane.prefPane | |
echo "remove items in /Library/TeX" | |
rm -rf /Library/TeX/.scripts /Library/TeX/Distributions | |
rm -f /Library/TeX/Documentation /Library/TeX/Local /Library/TeX/Root |
There are no guarantee to remove ALL.
This simply mainly depends on pkgutil(1).
This command use "receipt" database created by installer but installer could locate files not in "receipt" with postinstall script.
And this uninstall script has no update from Jan 27, 2013 and I have never install MacTeX from last update.
@EshanSingh, Uninstalling - MacTeX - TeX Users Group may help.
You can confirm postinstall scripts If MacTeX installer is available, extract xar -xf mactex-YYYYMMDD.pkg
and then *.pkg/Scripts
will be available.
postinstall scripts are available in these Scripts
, which are tar.gz
archives actually.
Thank you @uchida
Warning - this will remove everything in /usr/local
!
Use of rm -rf "${volume}${location}/${file}"
from pkgutil --files output is very dangerous!
Are you absolutely and totally sure this removes ALL traces of MacTex? I want to do an absolutely clean reinstall.