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

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:

  • brew unlink R solution
  • Install curl again

i figured out. i was all about the swap value.
there are several web pages that advice to decrease the default swap use in order to speed up ubuntu. what i did to fix the problem.

in the terminal...

#know the swap value    
cat /proc/sys/vm/swappiness
10
# access the swap configuration
gksudo leafpad /etc/sysctl.conf

# increase the swap usage to 30 (default is 60)
vm.swappiness=30

then, i rebooted. and installed the packages happily without any problems.

you can do it with pacakge roauth. i assume you have registered your app with twitter and have an api key. i pieced this together from other questions on (that question and associated answers also contains some links to other contributing questions) and the documentation for package roauth and twitter.

library(rcurl)
library(twitter)
library(roauth)

requesturl <- "https://api.twitter.com/oauth/request_token"
accessurl = "http://api.twitter.com/oauth/access_token"
authurl = "http://api.twitter.com/oauth/authorize"
consumerkey = "myconsumerkeystring"
consumersecret = "myconsumersecretstring"
cred <- oauthfactory$new(consumerkey=consumerkey,
                             consumersecret=consumersecret,
                             requesturl=requesturl,
                             accessurl=accessurl, 
                             authurl=authurl)
    #the next command provides a url which you will need to copy and paste into your favourite browser
    #assuming you are logged into twitter you will then be provided a pin number to type into the r command line
cred$handshake(cainfo = system.file("curlssl", "cacert.pem", package = "rcurl") )
    # checks that you are authorised
registertwitteroauth(cred)

i believe that use of the streaming api is handled by the package streamr

hth

you find the answer in your error message:

------------------------ anticonf error ---------------------------
configuration failed because libcurl was not found. try installing:
 * deb: libcurl4-openssl-dev (debian, ubuntu, etc)
....
....

copy and paste the following to your terminal and than try installing tidyverse again. should solve the problem.

# required for many packages
sudo apt-get install -y libxml2-dev libcurl4-openssl-dev libssl-dev

coming back to this issue i just wanted to point out that if you are still using rcurl, you should be using httr (which uses curl) instead.

i have confirmed that using config(cainfo="/topic/path/to/certificate") with httr connections will work as intended.


Tags: R Macos Rcurl