Skip to content

Instantly share code, notes, and snippets.

@muzimuzhi
Last active March 12, 2025 18:19
Show Gist options
  • Save muzimuzhi/cd910dabd16c8d82b06d7d7654a907e2 to your computer and use it in GitHub Desktop.
Save muzimuzhi/cd910dabd16c8d82b06d7d7654a907e2 to your computer and use it in GitHub Desktop.
upgrade and config basicTeX
##
# A script to upgrade and config basictex
# https://www.tug.org/mactex/morepackages.html
#
# References:
# - https://gist.github.com/kadrach/6228314
# - https://tex.stackexchange.com/a/304202
#
# Requirements:
# - homebrew
# - rg (https://github.com/BurntSushi/ripgrep)
#
# Author:
# - [email protected]
#
# Last update:
# - 13 Mar 2025
##
# Save list of installed packages
tlmgr list --only-installed | rg '^i ([^:]+):.*$' -r '$1' > tl-packages.txt
# Upgrade basictex
brew cask upgrade basictex
# Set a CTAN mirror
# - list of available CTAN mirrors: https://ctan.org/mirrors?lang=en
sudo tlmgr option repository https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet
# To keep it slim, basictex doesn't install package docs and sources by default
# Config tlmgr to install docs from now on
sudo tlmgr option docfiles 1
# (optional) Config tlmgr to install sources from now on
# sudo tlmgr option srcfiles 1
# Reinstall all packages to get docs
sudo tlmgr install --reinstall $(tlmgr list --only-installed | rg '^i ([^:]+):.*$' -r '$1'
# Install packages from the saved list
sudo tlmgr install $(cat tl_packages.txt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment