-
-
Save ysmintor/1fff42282e842be95b9d3858008f0f81 to your computer and use it in GitHub Desktop.
Generate MacTeX uninstall script
This file contains hidden or 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 | |
| # https://tug.org/mactex/uninstalling.html | |
| echo "# Uninstall TeX" | |
| echo "rm -rf /usr/local/texlive" | |
| echo "# Uninstall GUI Applications" | |
| echo "rm -rf /Applications/TeX" | |
| echo "# Uninstalling the TeX Distribution Data Structure" | |
| echo "rm -rf /Library/TeX" | |
| echo "rm -rf /Library/PreferencePanes/TeXDistPrefPane.prefPane" | |
| ## Uninstall Ghostscript | |
| # | |
| # MacTeX uninstaller script based on pkgutil command | |
| # by Akihiro Uchida, CC0 dedicated to the public domain | |
| # see http://creativecommons.org/publicdomain/zero/1.0/ | |
| # | |
| # https://gist.github.com/uchida/4632662 | |
| # https://github.com/kusm/dotfiles/blob/master/mactex-uninstaller | |
| IFS=' | |
| ' | |
| for pkg in $(pkgutil --pkgs | grep org.tug.mactex.ghostscript); do | |
| volume="$(pkgutil --pkg-info $pkg | grep volume | cut -d ' ' -f 2-)" | |
| location="$(pkgutil --pkg-info $pkg | grep location | cut -d ' ' -f 2-)" | |
| echo "# Uninstall $pkg" | |
| for file in $(pkgutil --files "$pkg" | tail -r); do | |
| path="$volume$location/$file" | |
| if [ -f "$path" ] ; then | |
| echo "rm -f \"$path\"" | |
| elif [ -d "$path" ] ; then | |
| echo "rmdir \"$path\"" | |
| fi | |
| done | |
| done | |
| for pkg in $(pkgutil --pkgs | grep org.tug.mactex); do | |
| echo "pkgutil --forget \"$pkg\"" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment