tinytex package issue on Mac M1
$$
\newcommand{\indep}{\mathrel{\perp\mkern-10mu\perp}}
\newcommand{\P}{\mathbb{P}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\E}{\mathbb{E}}
\newcommand{\Var}{\operatorname{Var}}
\newcommand{\Cov}{\operatorname{Cov}}
\newcommand{\1}[1]{\mathbf{1}\\{#1\\}}
$$
The issue of installing tinytex package on Mac M1.
When knitr LaTex file, the error message is like:
! sh: xelatex: command not found
Solve:
run this in your terminal (not in the R console):
# create the dir if it doesn't exist
[ -e /usr/local/bin ] || sudo mkdir -p /usr/local/bin
# change owner of the dir
sudo chown -R `whoami`:admin /usr/local/bin
~/Library/TinyTeX/bin/*/tlmgr path add