Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error reading R script (),system error 2 when trying to run R Studio on Mac

I installed R Studio desktop in my MacBook air running on Big Sur. Unfortunately, it cannot run due to the error below:

Error reading R script (),system error 2 (No such file or directory); Unable to find libR.dylib in expected locationswithin R Home directory /Library/Frameworks/R.framework/Resources

enter image description here

like image 520
Bundy Avatar asked Jun 28 '21 11:06

Bundy


People also ask

Why is my RStudio not opening on Mac?

I would recommend restarting your machine, and if the issue persists, remove RStudio, then reinstall RStudio and R using the instructions from Chapter 1 Getting Started with Data in R | Statistical Inference via Data Science. This topic was automatically closed 21 days after the last reply.

How do I run an R script on a Mac?

Start R by double-clicking on the program in your Applications folder, or in the Dock, if you put it there. The R graphical user interface (GUI) will open, containing a single window called the console window. The greater-than sign ( > ) is R's "prompt;" it indicates that R is ready for you to enter commands.


Video Answer


3 Answers

Running brew install R solves the problem for me.

like image 149
Teddy C Avatar answered Oct 12 '22 11:10

Teddy C


A similar question was asked on the R Studio community.

  • You need to first download base R:

    • Choose the latest version from here, under the Latest release header. For example, R-4.1.0.pkg.
  • Then download R Studio for MacOS from here.

like image 9
Tomerikoo Avatar answered Oct 12 '22 11:10

Tomerikoo


You have probably installed Rstudio before installing R. What you can do is to first install R using brew install R and then reinstalling Rstudio using brew reinstall rstudio.

like image 9
RyanAbnavi Avatar answered Oct 12 '22 11:10

RyanAbnavi