I'm using RStudio Version 1.3.1093 on a Mac running MacOS Big Sur 11.2. Can't create R Markdown files. On selecting 'File > New File> R Markdown' RSudio prompted me to install an 'updated version of the Tinytex package' but even after I installed this package, the same RStudio prompt came up repeatedly upon trying again. Quit RStudio repeatedly - still didn't work. Installed the RMarkdown package from CRAN (install .packages("rmarkdown")) but this did not help either.
Can you post the output you get if you try to manually install TinyTex?
install.packages("tinytex")
HELLO - I EVEN RE-INSTALLED RSTUDIO AND THEN INSTALLED PACKAGES AS BELOW BUT STILL NO LUCK:
install.packages("rmarkdown")
install.packages("knitr")
install.packages("tinytex")
install.packages("here")
install.packages("tidyverse")
install.packages("broom")
install.packages("fs")
install.packages("usethis")
TO ANSWER YOUR QUESTION, BELOW IS THE OUTPUT IN THE CONSOLE WHEN MANUALLY INSTALLING 'XFUN' AND 'TINYTEX' (YES, NOW IT'S NOT JUST 'TINYTEX' THAT DOESN'T INSTALL, ALSO 'XFUN'!). THANKS FOR HELPING OUT.
installing the source package ‘xfun’
trying URL 'https://cran.rstudio.com/src/contrib/xfun_0.21.tar.gz'
Content type 'application/x-gzip' length 103228 bytes (100 KB)
==================================================
downloaded 100 KB
* installing *source* package ‘xfun’ ...
** package ‘xfun’ successfully unpacked and MD5 sums checked
** libs
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘xfun’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/xfun’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/xfun’
[2/2] Installing tinytex...
The downloaded source packages are in
‘/private/var/folders/sj/pzkrqfcs5hxf_342x94rsp_00000gn/T/Rtmp30URDj/downloaded_packages’
also installing the dependency ‘xfun’
There are binary versions available but the source versions are later:
binary source needs_compilation
xfun 0.12 0.21 TRUE
tinytex 0.20 0.29 FALSE
installing the source packages ‘xfun’, ‘tinytex’
trying URL 'https://cran.rstudio.com/src/contrib/xfun_0.21.tar.gz'
Content type 'application/x-gzip' length 103228 bytes (100 KB)
==================================================
downloaded 100 KB
trying URL 'https://cran.rstudio.com/src/contrib/tinytex_0.29.tar.gz'
Content type 'application/x-gzip' length 27768 bytes (27 KB)
==================================================
downloaded 27 KB
* installing *source* package ‘xfun’ ...
** package ‘xfun’ successfully unpacked and MD5 sums checked
** libs
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘xfun’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/xfun’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/xfun’
* installing *source* package ‘tinytex’ ...
** package ‘tinytex’ successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
namespace ‘xfun’ 0.12 is being loaded, but >= 0.19 is required
ERROR: lazy loading failed for package ‘tinytex’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/tinytex’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/tinytex’
The downloaded source packages are in
‘/private/var/folders/sj/pzkrqfcs5hxf_342x94rsp_00000gn/T/Rtmp30URDj/downloaded_packages’
✔ Packages successfully installed.
Warning messages:
1: In utils::install.packages("xfun", repos = "https://cran.rstudio.com/") :
installation of package ‘xfun’ had non-zero exit status
2: In utils::install.packages("tinytex", repos = "https://cran.rstudio.com/") :
installation of package ‘xfun’ had non-zero exit status
3: In utils::install.packages("tinytex", repos = "https://cran.rstudio.com/") :
installation of package ‘tinytex’ had non-zero exit status
Just to add the new version of RStudio I downloaded is Version 1.4.1103 for Mac.
Packes are not getting installed because for old R versions, like the one you have installed, they are only available in source form so they require compilation, and you don't have Xcode installed in your system.
For installing packages from source on macOS you need to install Xcode in your system (not in R) and the recommended development tools for macOS systems.
https://cran.r-project.org/bin/macosx/tools/
BTW updating RStudio has no effect on your R version or your package library.
Thanks, that's really helpful. Would it be better to periodically update R? If so what is the best way? Uninstall current R version and then update?
There no absolute answer for this, it depends on your specific scenario. My opinion is that for personal use, it is better to always have the latest stable version but for "production" environments it is better to test your workflows and applications before updating so you don't break them.
I'm not a macOS user so I'm just guessing here but since it is a UNIX-based operating system I think you just need to install the latest version and update your R packages with the option checkBuilt
enabled.
Thanks, I will first attempt the R upgrade.
Downloaded and installed latest R version (4.0.3). Seems to have fixed the R Markdown file problem. Many thanks for all your help.
I am Windows user, just installed the latest R version, and am having the same problem with R markdown files. I tried typing intallation code but did not work.. I hope someone could help me here...
please reply if it is better for me to ask by opening another topic!!
I am so lost...please help
I am not a Windows user so it might be better to open a new topic to get help.
thank you for the advice!!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.