Last active
March 1, 2018 16:08
-
-
Save uchida/4632662 to your computer and use it in GitHub Desktop.
MacTeX uninstaller script based on pkgutil command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Warning - this will remove everything in
/usr/local
!Use of
rm -rf "${volume}${location}/${file}"
from pkgutil --files output is very dangerous!