MacTeXをリフレッシュする

VS Codeで$\TeX$を使おうと「[VSCode で最高の LaTeX 環境を作る](https://qiita.com/Gandats/items/d7718f12d71e688f3573)」を参考にして環境構築していたのですが、どうしてもうまくいかず、思い切ってTeXを削除してインストールしました。

```shell:.refresh_tex.sh
# 消したくないものをDesktopに残しておく
cp -r ~/latex-inputs ~/Desktop
# TeXの削除
rm -rf ~/Library/texmf
rm -rf ~/Library/texlive
sudo rm -rf -v /usr/local/texlive # passwordを入力
sudo rm -rf -v /Library/TeX
sudo rm -rf -v /Applications/TeX
# GhostScripts関連のファイルを削除
# See https://gist.github.com/gwerbin/dcba755b0484423e9e45
sudo rm -rf -v /usr/local/bin/dvipdf
sudo rm -rf -v /usr/local/bin/eps2eps
sudo rm -rf -v /usr/local/bin/font2c
sudo rm -rf -v /usr/local/bin/gs-X11
sudo rm -rf -v /usr/local/bin/gs-X11-64Bit
sudo rm -rf -v /usr/local/bin/gs-X11-Yosemite
sudo rm -rf -v /usr/local/bin/gs-noX11
sudo rm -rf -v /usr/local/bin/gs-noX11-64Bit
sudo rm -rf -v /usr/local/bin/gs-noX11-Yosemite
sudo rm -rf -v /usr/local/bin/gsbj
sudo rm -rf -v /usr/local/bin/gsdj
sudo rm -rf -v /usr/local/bin/gsdj500
sudo rm -rf -v /usr/local/bin/gslj
sudo rm -rf -v /usr/local/bin/gslp
sudo rm -rf -v /usr/local/bin/gsnd
sudo rm -rf -v /usr/local/bin/lprsetup.sh
sudo rm -rf -v /usr/local/bin/pdf2dsc
sudo rm -rf -v /usr/local/bin/pdf2ps
sudo rm -rf -v /usr/local/bin/pf2afm
sudo rm -rf -v /usr/local/bin/pfbtopfa
sudo rm -rf -v /usr/local/bin/pphs
sudo rm -rf -v /usr/local/bin/printafm
sudo rm -rf -v /usr/local/bin/ps2ascii
sudo rm -rf -v /usr/local/bin/ps2epsi
sudo rm -rf -v /usr/local/bin/ps2pdf
sudo rm -rf -v /usr/local/bin/ps2pdf12
sudo rm -rf -v /usr/local/bin/ps2pdf13
sudo rm -rf -v /usr/local/bin/ps2pdf14
sudo rm -rf -v /usr/local/bin/ps2pdfwr
sudo rm -rf -v /usr/local/bin/ps2ps
sudo rm -rf -v /usr/local/bin/ps2ps2
sudo rm -rf -v /usr/local/bin/unix-lpr.sh
sudo rm -rf -v /usr/local/bin/wftopfa
sudo rm -rf -v /usr/local/share/man/de/man1/dvipdf.1
sudo rm -rf -v /usr/local/share/man/de/man1/font2c.1
sudo rm -rf -v /usr/local/share/man/de/man1/gsnd.1
sudo rm -rf -v /usr/local/share/man/de/man1/pdf2dsc.1
sudo rm -rf -v /usr/local/share/man/de/man1/pdf2ps.1
sudo rm -rf -v /usr/local/share/man/de/man1/printafm.1
sudo rm -rf -v /usr/local/share/man/de/man1/ps2ascii.1
sudo rm -rf -v /usr/local/share/man/de/man1/ps2pdf.1
sudo rm -rf -v /usr/local/share/man/de/man1/ps2ps.1
sudo rm -rf -v /usr/local/share/man/de/man1/wftopfa.1
sudo rm -rf -v /usr/local/share/man/man1/dvipdf.1
sudo rm -rf -v /usr/local/share/man/man1/font2c.1
sudo rm -rf -v /usr/local/share/man/man1/gs.1
sudo rm -rf -v /usr/local/share/man/man1/gslp.1
sudo rm -rf -v /usr/local/share/man/man1/gsnd.1
sudo rm -rf -v /usr/local/share/man/man1/pdf2dsc.1
sudo rm -rf -v /usr/local/share/man/man1/pdf2ps.1
sudo rm -rf -v /usr/local/share/man/man1/pf2afm.1
sudo rm -rf -v /usr/local/share/man/man1/pfbtopfa.1
sudo rm -rf -v /usr/local/share/man/man1/printafm.1
sudo rm -rf -v /usr/local/share/man/man1/ps2ascii.1
sudo rm -rf -v /usr/local/share/man/man1/ps2epsi.1
sudo rm -rf -v /usr/local/share/man/man1/ps2pdf.1
sudo rm -rf -v /usr/local/share/man/man1/ps2pdfwr.1
sudo rm -rf -v /usr/local/share/man/man1/ps2ps.1
sudo rm -rf -v /usr/local/share/man/man1/wftopfa.1
sudo rm -rf -v /usr/local/share/ghostscript/
# GhostScriptsの削除
brew uninstall ghostscript
brew uninstall --force imagemagick
# basictex があれば削除
brew list --cask | grep basicte
brew cask uninstall basictex
# mactex-no-guiの再インストール
brew cask install mactex-no-gui
brew cask reinstall mactex-no-gui
# バージョン確認
platex -v
latexmk -v
```

このファイルを`~/.refresh_tex.sh`として保存しておき、ターミナルから

```bash
$ source ~/.refresh_tex.sh
```

と打てば自動的にアンインストール、リインストールができます。VS Codeのアンインストール、リインストールは[このページ](https://qiita.com/okazakik/items/37592fd00151e086f45a)をご覧ください。