`pdflatex: command not found` on macOS with MacTeX installed
Source: Troubleshooting reference
Symptom. brew list --cask shows mactex and
/Library/TeX/texbin/pdflatex exists and is executable, but pdflatex,
latexmk, chktex, and texcount all report “command not found”.
Root cause. MacTeX installs into /Library/TeX/texbin, which is on no
default PATH. Its installer drops a /etc/paths.d/TeX entry, but that only
reaches path_helper-processed shells, and these profiles rebuild PATH
themselves. install/latex.sh verified the binary by absolute path, so the
step reported [okay] while nothing was actually reachable.
Confirm.
ls /Library/TeX/texbin/pdflatex # existscommand -v pdflatex # nothingFix. Handled by both shell profiles:
[ -d /Library/TeX/texbin ] && path=($path /Library/TeX/texbin) # zprofileAppended, not prepended, so Linux’s TinyTeX binaries (symlinked into
$ARCH_BIN by latex.sh) keep priority on a machine with both. Run
chezmoi apply ~/.zprofile ~/.bash_profile and start a new shell.