However complete your TeX install looks, you will soon want a package it lacks, or a font that licensing keeps out of the box. This page covers the commands you actually type day to day — TeX Live’s tlmgr and its tlshell GUI, getnonfreefonts for fonts shipped separately, and kpsewhich to answer “where does that file live?” — with what each one does and why you reach for it.
Managing packages with tlmgr
tlmgr (the TeX Live Manager) is the official command for installing, removing, and updating TeX Live packages. It is how you add any of the thousands of CTAN packages your install happens to be missing — the same on Japanese and English setups alike (MiKTeX is a separate world; see below). Start by installing a package by name; its dependencies come along by default.
# パッケージを 1 つ以上インストール(依存も自動で入る)
tlmgr install siunitx
tlmgr install collection-fontsrecommended
# 依存を引かずに本体だけ/既存の上書き再インストール
tlmgr install --no-depends siunitx
tlmgr install --reinstall siunitxWhen packages go into the system-wide tree, tlmgr must run with administrator rights (sudo tlmgr install … on Unix, an elevated shell on Windows). You can also drop files into a per-user tree (TEXMFHOME) by hand, but tlmgr manages the distribution’s own trees. Which tree holds what, and how paths resolve, is the subject of “TeX directory structure & paths” — here we simply trust tlmgr to put things in the right place.
Learn updates as a pair. --self brings tlmgr itself (the infrastructure) up to date; --all brings every other installed package up to date. Giving both at once is the standard move — tlmgr replaces itself first, then updates the rest. This is also when it auto-removes packages dropped on the server and auto-installs new members of a collection.
# 定番:自分自身 → 全パッケージの順で最新化
tlmgr update --self --all
# 特定パッケージだけ更新/更新があるか一覧で確認
tlmgr update siunitx
tlmgr update --listtlmgr info tells you about a package. With no argument it lists every package, marking installed ones with a leading i. Give it a name and it prints the description, license, sizes, contained files, and TeX Catalogue data — querying the repository even for packages you have not installed. When you only half-remember a name, search helps: --global searches the repository rather than your local install, and --file searches by file name across packages.
# パッケージの詳細(説明・ライセンス・収録ファイル)
tlmgr info siunitx
# 名前・説明から探す/ファイル名で横断検索
tlmgr search --global siunit
tlmgr search --global --file tikz.styChoosing a repository (CTAN mirror)
The repository is where tlmgr fetches packages from. By default it uses CTAN’s automatic mirror redirection, but when a connection is slow or you want to pin one mirror, switch permanently with tlmgr option repository. The alias ctan is shorthand for https://mirror.ctan.org/systems/texlive/tlnet; pointing at it routes you to a nearby CTAN mirror automatically.
# 既定(近くの CTAN ミラーへ自動振り分け)に設定
tlmgr option repository ctan
# 特定ミラーへ固定(例:好きな tlnet ミラーの URL)
tlmgr option repository https://example.org/CTAN/systems/texlive/tlnet
# 今の設定をまとめて確認(repository だけでなく paper なども)
tlmgr option showTo pull from a different mirror just this once, add --repository <url> for that single run without touching the permanent setting. Note that tlmgr option also holds defaults such as paper size: to switch paper for every tool at once use tlmgr paper a4 (or per program, tlmgr dvips paper a4).
The GUI (tlshell), and MiKTeX
If the command line is not your thing, TeX Live ships tlshell, a Tcl/Tk GUI (launch it with tlshell). It is a front end that simply drives tlmgr, so it can do the same things — search, install, remove, bulk-update packages, and switch repositories from a window. It even shows the underlying command log, which makes it a gentle way to learn what tlmgr is doing.
MiKTeX (mostly Windows) is a separate world: instead of tlmgr, its command line is mpm (the MiKTeX Package Manager) and its GUI is the MiKTeX Console. MiKTeX’s hallmark is on-the-fly installation — when a document asks for a package you do not have, it downloads and installs it mid-compile (the Console lets you set this to always install, ask each time, or never). The idea is the same; just the command names and workflow differ.
Fonts shipped separately — getnonfreefonts
Some fonts carry licenses like “free to use, but may not be sold,” so they cannot ride along in TeX Live, which is also distributed on a for-sale DVD. TUG’s getnonfreefonts script handles installing exactly these. CTAN holds the fonts and their TeX support files; the script fetches them and wires everything up so TeX can find them.
You install the script itself once first (follow the steps at tug.org/fonts/getnonfreefonts/). List the fonts it offers with --lsfonts, then install one by name. The typewriter font luximono is one such target, for example.
# 入れられるフォントの一覧を見る
getnonfreefonts --lsfonts
# 個別に入れる/配布元のものを全部入れる
getnonfreefonts luximono
getnonfreefonts --allThe key is the -sys variant. getnonfreefonts installs into your personal tree (TEXMFHOME), while **getnonfreefonts-sys** installs into the system-wide tree. For everyone on the machine, run the latter with administrator rights. Afterwards the filename database may need refreshing (mktexlsr), though the script usually takes care of it. Those font and database commands are covered in “Font & DB tools.”
# システム全体のツリーへ(全ユーザ向け・要管理者権限)
sudo getnonfreefonts-sys luximono
# 念のため手動でファイル名 DB を更新する場合
sudo -H mktexlsrFinding files with kpsewhich
TeX locates files through a search library called kpathsea, and kpsewhich is the tool that queries that same search from your shell. It answers “which file does this class actually resolve to?” and “are two versions colliding?” in one shot — the first move in most troubleshooting. Hand it a file name and it prints the first path TeX would pick up.
# このファイルが解決される実際のパスを表示
kpsewhich article.cls
kpsewhich siunitx.sty
# 同名ファイルが複数あれば全部出す(衝突の発見に)
kpsewhich -all siunitx.styBeyond paths, it also reports configuration variable values. -var-value=VAR prints the expansion of variable VAR — handy for finding where your user tree (TEXMFHOME) or config tree (TEXMFCONFIG) actually lives. Two kinds of expansion exist: -expand-var expands variables only, while -expand-path fully expands a path including braces.
# 設定変数の値を見る(ユーザツリーの場所など)
kpsewhich -var-value=TEXMFHOME
kpsewhich -var-value=TEXMFCONFIG
# 変数だけ展開 / パス全体を完全展開
kpsewhich -expand-var='$TEXMFHOME'
kpsewhich -expand-path='$TEXMF'To disambiguate same-named files of different kinds, use -format=NAME. BibTeX styles (.bst) and bibliography data (.bib), for instance, have separate search paths, so naming the file type resolves the right one. -show-path=NAME prints the entire search path for that type, showing which directories are searched and in what order. List the type names with kpsewhich --help.
# ファイル種別を指定して探す(.bst と .bib は別パス)
kpsewhich -format=bst plainnat.bst
kpsewhich -format=bib mybibliography.bib
# その種別の探索パス全体を表示(探索順の確認)
kpsewhich -show-path=texWhen the search path depends on the engine, match the context with -engine=NAME or -progname=NAME (e.g. -progname=lualatex). The mechanics of the search itself — the role of texmf.cnf and how the trees are traversed — belong to “TeX directory structure & paths”; here we use kpsewhich purely as a tool for checking what resolves to what.