R bookdown on mac El Capitan

Was excited to see R bookdown from Yuhui Xe of RStudio, but when I tried to get started, I ran into a problem.

I am using (mac) OS X El Capitan 10.11.6 and when I tried to “build the book”, I got the following error:

xelatex: command not found.

I realized I never installed LaTex on my mac, so I tried to download MacTex 2016 from the main site, but that link did not download the package for me! It just displayed some text response.

Looking at MacTex FAQ, I found the mirror site. I could then download the package from one of the mirrors close to me. The size of the package was 2.7 GB. With that I installed LaTex.

There is one more step required though. We need to set the PATH variable. I edited my ~/.bashrc and added /Library/TeX/texbin to it. Then I restarted RStudio. I was then able to build the book 🙂

Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *