RStudio Start-Up Library Error

Error Information: RStudio would not load due to a library error, which is shown below.

Description of issue - RStudio will not work with the error message above.

Attempted steps taken to fix - Have downloaded/re-downloaded R+XQuartz and RStudio multiple times, thinking it may be an error in the way I was downloading it.

System Information:

  • RStudio Edition: Desktop
  • RStudio Version: RStudio Desktop 1.4.1106
  • OS Version: macOS Big Sur 11.2.3
  • R Version: 4.1.0
  • Output your diagnostics report (if possible):
dyld: could not load inserted library '/Library/Frameworks/R.framework/Resources/lib/libR.dylib' because no suitable image found. Did find:
/Library/Frameworks/R.framework/Resources/lib/libR.dylib: mach-o, but wrong architecture
/Library/Frameworks/R.framework/Resources/lib/libR.dylib: stat() failed with errno=1

It is possible that you attempted to install one or both of R or RStudio from source, rather than as a binary object. Anything involving macOS and compilation from source is doubtful due to Apple's non-standard compiler chain. Without advanced expertise, any time that an installation of software from source, generally, or an R package, specifically, fails, it is best to seek a precompiled binary, especially on the new M1 chipset.

Therefore, do not attempt to install R-4.1.0.tar.gz from CRAN. Instead install the dmg binary for Intel or the M1 version. If, however, R works from the terminal command line,

$ R

and it returns a splash page and then the prompt

>

you do not need to reinstall.

If you do install from the dmg, take the option to install for all users and enter an admin password.

For RStudio, install the dmg file.

Once R is working from RStudio, when installing packages you will often be presented with a message to the effect that

a binary version is available, but the source version is later

and it costs only a little trouble to try. If it does not work the first time, it will not work subsequently without more time, trouble and effort than anyone who is not a highly evolved expert would care to use, as it rerquires editing source code.

As much as I enjoyed macOS over the years, the issues around compilation of R and other open source libraries drove me to Ubuntu, where I have no problems of this sort.

So, first of all. Thanks for the help!

However, I am not a programmer or code specialist by trade and my first exposure to coding (at all) was with R. So...how exactly do I find the terminal command line and splash page?

[I should note that I proceeded as you said in terms of downloads and it still didn't work, spit out the same error, so I assume it has to do with what you've said, but I don't know how to find that!)

Open the Finder app, click into Applications then its Utilities folder (if memory serves) and click on the Terminal app. You should get a black screen with the $ prompt. Type R (case sensitive) and enter.

So it did end up allowing me to do it as you said with the blank screen, but I'm still getting the library error (as noted above) with RStudio.

As in...

This is what was returned when I used % R (the command has changed to that)

It returned:

% R

R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 

Still spits out "The R session process exited with code 6" and this error when I attempted to enter RStudio:

dyld: could not load inserted library '/Library/Frameworks/R.framework/Resources/lib/libR.dylib' because no suitable image found. Did find:
/Library/Frameworks/R.framework/Resources/lib/libR.dylib: mach-o, but wrong architecture
/Library/Frameworks/R.framework/Resources/lib/libR.dylib: stat() failed with errno=1

OK, this means that R is working with the latest version, which requires a different version of RStudio from https://s3.amazonaws.com/rstudio-ide-build/desktop/macos/RStudio-1.4.1717.dmg

That worked! Thank you so much!

1 Like

Hi Technocrat:

New to R, taking a data science course. I think I have the same problem as adperdue did, but your alternative version of RStudio still gave me the same error pasted below. I'm on a Mac OS X Big Sur 11.4, and downloaded the binary R version from CRAN and the 1.4.1717 version of RStudio using your link. Your help much appreciated.

R Session Startup Failure Report

RStudio Version

RStudio 1.4.1717, "Juliet Rose" (df86b69e, 2021-05-24) for macOS

Mozilla/5.0 (Macintosh; Intel Mac OS X 11_4_0) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.10 Chrome/69.0.3497.128 Safari/537.36

Error message

[No error available]

Process Output

The R session exited with code 1.

Error output:

[No errors emitted]

Standard output:

[No output emitted]

Logs

**


Try opening an R console from the terminal with

$ R

or from the R in the Applications folder, and report the version of R and whether it works; we can then decide what to do about RStudio

Thanks, technocrat. Here's the version (and yes, it runs on its own):

R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"

Copyright (C) 2021 The R Foundation for Statistical Computing

Platform: x86_64-apple-darwin17.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.

You are welcome to redistribute it under certain conditions.

Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors.

Type 'contributors()' for more information and

'citation()' on how to cite R or R packages in publications.

That combination of R and RStudio works on at least some macOS configurations. If you are on Big Sur, I assume your machine isn't M1. I had an earlier configuration working under Catalina, but you probably have your reasons for remaining on Big Sur. If you've used AppZap or similar to wipe RStudio and re-install, that eliminates the corrupt file possibility. I'm not fully over to Ubuntu for R with no issues. Three temporary fixes suggest themselves while waiting for a possible macOS fix:

  1. RStudio cloud (if you take care to keep a local copy of your code; it's been know to freeze)
  2. Ubuntu on a removable drive (if you are familiar with macOS terminal, it's not a steep learning curve)
  3. AMZ EC2 instance or other cloud server on which you can install a container image

Wish I had more to suggest.

Thanks for the quick feedback. I also noticed the install went into usr/local/bin/R instead of usr/bin/R and was trying to figure out how to point RStudio to the right location. Meantime, I guess it's time to update Mac OS version. Will let you know if that works.

If you add /usr/local/bin/R to your $PATH, if you installed as a user or if you installed system wide you may need to adjust it under whatever user it runs under.

FWIW: Other than burning the usual three hours, my Catalina install was nominal.

Just to clarify, Big Sur (10.16, or 11 in their new OS numbering scheme) is the latest version of macOS and is required for M1 macs. Catalina (10.15) is the previous version. My RStudio has been problem free under both OS versions. I am currently on the CRAN release of R 4.1 compiled for 10.13 High Sierra. Make sure not to download the one compiled for Big Sur as it is only compatible with M1 macs.

The R alias is in my usr/local/bin, not usr/bin, and works fine.

1 Like

Thanks for the clarification. :grinning:

Hi there,

I already read all your entries and tried to do what you suggested but still couldn't run it. Since I'm just economics student I don't have any idea about those technological software things :frowning: I was using R Studio 3 years ago but don't know what is the problem now.

  • macOS Big Sur 11.6
    -in utilities there is % and I tried R and also $ R enter but it was saying command not found

Thanks in advance.

I also have similar issues if anyone can help. I have a new MacBook Air M1 with Bigger 11.6, I've tried downloading R and R studio on the following;owing link Download the RStudio IDE - RStudio for 10.14+ but I can't get it to work/open up
It all works on my older MacBook Air.
When I type the command $ R into the R console I get error messages....
Can anyone help?
Many thanks

Sorry that should say Big Sur 11.6