This documents troubleshooting attempts related with curl.
(updated on 2025-01-19)

0. Basic info

My computer

macOS Big Sur
Version 11.7.4

R

R version 4.4.2 (2024-10-31) -- "Pile of Leaves"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20

R Studio

Version 2024.12.0+467 (2024.12.0+467)

1. The problem

I was able to publish rMarkdown and Shiny outputs perfectly until the end of last year. But, not any more, since I upgraded R version - I actually do not know exactly what I did…Ugh…

And, it turned out that I cannot even load curl successfully. See below. FYI, I have no problem creating various outputs (e.g., html via rmarkdown and shiny app - tested with multiple files/scripts).

This error message is very similar to what I get when I tried to publish html to RPub or Shiny app, which made me start this investigation. See below.

Error when publishing html to rPub

Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/curl/libs/curl.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/curl/libs/curl.so, 6): Symbol not found: _curl_easy_option_by_id
  Referenced from: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/curl/libs/curl.so
  Expected in: flat namespace
 in /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/curl/libs/curl.so
Calls: <Anonymous> ... createCurlHandle -> loadNamespace -> library.dynam -> dyn.load
Execution halted

Error when deploying shiny app

Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/curl/libs/curl.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/curl/libs/curl.so, 6): Symbol not found: _curl_easy_option_by_id
  Referenced from: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/curl/libs/curl.so
  Expected in: flat namespace
 in /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/curl/libs/curl.so

2. Possible causes?

It appears that this may be something to do with finding the right directory (or not, of course).

People seem to have kind of related problems. See examples. None of them is identical with my problem, I think, but they gave me an idea about the possible cause. To be clear, I understand only little of what these people are talking about…

3. Investigation

3.1. curl?

curl package information: https://cran.r-project.org/web/packages/curl/index.html

# Path for this file, FYI          
getwd()

[1] “/Users/yoonjoungchoi/Dropbox/2R/2R_0_Troubleshoot”

# Where is the path that packages are installed?    
.libPaths()

[1] “/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library”

# Do I have the curl package?    
installed.packages("curl")
 Package LibPath Version Priority Depends Imports LinkingTo Suggests
 Enhances License License_is_FOSS License_restricts_use OS_type Archs
 MD5sum NeedsCompilation Built
# Where is the curl package is installed?    
find.package("curl")

[1] “/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/curl”

# More information about the installed package: date
packageDate("curl")

[1] “2024-12-22”

# More information about the installed package: version
packageVersion("curl")

[1] ‘6.1.0’

# What version of libcurl is in use? 
# EVEN THOUGH I DO NOT KNOW WHAT "libcurl" IS...  
libcurlVersion()

[1] “8.4.0” attr(,“ssl_version”) [1] “SecureTransport (LibreSSL/3.3.6)” attr(,“libssh_version”) [1] “” attr(,“protocols”) [1] “dict” “file” “ftp” “ftps” “gopher” “gophers” “http”
[8] “https” “imap” “imaps” “ldap” “ldaps” “mqtt” “pop3”
[15] “pop3s” “rtsp” “smb” “smbs” “smtp” “smtps” “telnet” [22] “tftp”

Of note, how find.package() and installed.packages() results look like from a different package, just for comparison…

installed.packages("ggplot2")
 Package LibPath Version Priority Depends Imports LinkingTo Suggests
 Enhances License License_is_FOSS License_restricts_use OS_type Archs
 MD5sum NeedsCompilation Built
find.package("ggplot2")

[1] “/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/ggplot2”

3.2. other required packages to publish rmarkdown html output?

I have no problem loading ones other than curl…

library(openssl)
library(rstudioapi)
library(packrat)
library(rsconnect)

4. AND, WHAT SHOULD I DO NEXT?!

FYI, what I’ve tried so far

Below is what I’ve done so far with no success…

  1. Uninstalled R completely and re-installed a recent version (R version 4.3.3 (2024-02-29) – “Angel Food Cake”), in case it is something to do with upgrade. Same problem.

  2. Tried with earlier version of RStudio, in case it is something to do with upgrade - specifically, 2024.09.1+394.pro7 and 2024.04.2+764.pro1. https://dailies.rstudio.com/release/ Same problem.

  3. Should I install older curl, in case something happened when I upgraded R? https://cran.r-project.org/src/contrib/Archive/curl/ Let’s downgrade from 6.1.0 to 5.2.3. But it did not work, and I had different/additional error. So, I brought the latest version back.

  4. All suggestions here https://github.com/StatCan/aaw-kubeflow-containers/issues/569

  • options(repos = c(CRAN = “https://cloud.r-project.org”)) ===> No change
  • options(download.file.method=“wget”) ===> different errors
  1. Modified “Edit > Preferences” to change/confirm the default working directory to the directory that houses R packages. Same problem.