Nick Malleson
Nick Malleson

Reputation: 105

installation of package ‘RCurl’ had non-zero exit status

I am trying to install RCurl on OS X 10.12.6 but get the following error:

Error: package or namespace load failed for ‘RCurl’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Users/nick/Library/R/3.4/library/RCurl/libs/RCurl.so':
  dlopen(/Users/nick/Library/R/3.4/library/RCurl/libs/RCurl.so, 6): Library not loaded: @rpath/libcurl.4.dylib
  Referenced from: /Users/nick/Library/R/3.4/library/RCurl/libs/RCurl.so
  Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Users/nick/Library/R/3.4/library/RCurl’

The downloaded source packages are in
    ‘/private/var/folders/hx/9xx9fwq91t95k45dzlmzxfy40000gp/T/Rtmp14zSi1/downloaded_packages’
Warning message:
In install.packages("RCurl") :
  installation of package ‘RCurl’ had non-zero exit status

This error has been discussed a bit already, but the solutions are all specific to linux and I don't think they are relevant to OS X. I did try installing the homebrew version of curl but that didn't help.

Any ideas? I think that more debugging information would be helpful, but I'm not sure what else to provide.

Thanks in advance! Nick

Upvotes: 7

Views: 10531

Answers (4)

Sander W. van der Laan
Sander W. van der Laan

Reputation: 790

I tried all the above and all failed. I am on macOS Sonoma (beta 5) with brew, see below.

The simplest solution was to download the packaged archive directly from CRAN and install this (I did this through RStudio). Then I could install the other packages that I actually need (RCurl was just a means to an end for me).

$ brew config
HOMEBREW_VERSION: 4.1.5
ORIGIN: https://github.com/Homebrew/brew
HEAD: b8b46501e4caa1cad75b30627c123127ab09a6a7
Last commit: 3 days ago
Core tap JSON: 17 Aug 02:05 UTC
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.QHQiUVr7Uo/org.xquartz:0
HOMEBREW_MAKE_JOBS: 10
Homebrew Ruby: 2.6.10 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: 10-core 64-bit westmere
Clang: 15.0.0 build 1500
Git: 2.41.0 => /usr/local/bin/git
Curl: 8.1.2 => /usr/bin/curl
macOS: 14.0-x86_64
CLT: 15.0.0.0.1.1691205695
Xcode: N/A
Rosetta 2: true

By the way: make sure to use the right architecture. If you activated Rosetta 2, choose the INTEL version of RCurl.

Upvotes: 0

Lucas
Lucas

Reputation: 1448

If someone face the same problem in Ubuntu just as I do, the solution is run first in terminal:

sudo apt-get install libcurl4-gnutls-dev

Then in R:

install.packages('RCurl')

Upvotes: 5

Peter M
Peter M

Reputation: 844

In case it is useful for anyone else with this issue, I solved it without having to install the cran binary of R. (I use the homebrew version because it allows you to use faster BLAS options that take advantage of parallelism). Steps were:

  1. Make sure that R doesn't find the homebrew or anaconda versions of curl-config (this will only affect the current R session)

    PATH=/usr/bin/:$PATH
    
  2. Download and install latest version of RCurl from http://www.omegahat.net/RCurl/ (replace <RCURLVERSION> with the current latest version)

    wget http://www.omegahat.net/RCurl/RCurl_<RCURLVERSION>.tar.gz
    R CMD INSTALL RCurl_<RCURLVERSION>.tar.gz
    

Upvotes: 1

RobinLovelace
RobinLovelace

Reputation: 4987

Looks like it's expecting libcurl.4.dylib in your @rpath.

I think others have encountered the same issue so the solution should be in here somewhere:

Upvotes: 1

Related Questions