I updated my Mac to OS X El Capitan and knitr doesn't work on it. Before the update everything was fine. Now LyX is saying : "The module knitr requires a package that is not available in your LaTex installation". But before the update it was available!

So I can't compile my documents. Can someone help me?


I had the same problem with El Capitan, knitr and TeXShop. The issue is related to new security features of El Capitan that restrict access to the /usr folder. I reinstalled the latest versions of MacTeX and R and now am able to compile knitr files just fine.

For additional detail, see this explanation (though it doesn't address knitr): https://tug.org/mactex/UpdatingForElCapitan.pdf


I also had this problem thanks to the restrictions on writing to /usr in El Capitan. Redownloading R and MacTex does solve the problem, as mentioned in another answer, but you can avoid re-downloading MacTex by entering this into terminal:

cd /Library/TeX
sudo ln -s Distributions/Programs/texbin texbin
echo "/Library/TeX/texbin" >~/Desktop/TeX
sudo cp ~/Desktop/TeX /etc/paths.d/TeX

Rscript is off limits now though, thanks to the changes. Try checking in Terminal: which Rscript. I had to re-download R though, which worked. Now when I do which Rscript I get:


Alternatively, try running in Rstudio, which accesses R directly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.