Install BasicTex.
Add this to your Bash or Zsh:
export PATH="/Library/TeX/texbin/:$PATH"
Install missing Tex packages:
sudo tlmgr install capt-of needspace datetime fmtcount makecell eqparbox environ framed latexmk tabulary varwidth titlesec
apt install texlive-xetex latexmk # only to generate PDF
pip3 install sphinx
For RTEMS docs, additionally:
sudo apt install texlive-fonts-extra
I also needed to run
but the PDF generated was still too corrupted