Can't install any packages in R

My RStudio version is Version 2024.04.1+748 (2024.04.1+748) and my R is R version 4.4.0 (2024-04-24) -- "Puppy Cup".

I have been having trouble installing any packages. For example, when I installed 'tidyverse' the error message was long and contained very similar info, such as "Warning in install.packages :
installation of package ‘tidyselect’ had non-zero exit status
ERROR: dependencies ‘openssl’, ‘uuid’ are not available for package ‘ids’". So it seems like dependency issue. The long error message also has 'ERROR: compilation failed for package ‘backports’' and "/bin/sh: /opt/homebrew/bin/gcc-13: No such file or directory".

tidyverse is a container package, containing very many members; therefore if one has a problem, the entire tidyverse install will fail. Unfortunately the best advice you can be given is to proceed one at a time through the items that need specific attention.

Up front we can say that if you are a windows user you should have RTools (which is not a package but a utility to help compile binaries from source) RTools: Toolchains for building R and R packages from source on Windows (r-project.org)

if you are on a linux type machine, you may need to install system utilities related to compilation, like gcc for example; ways to go about this then depend on your linux distribution. When I search up gcc homebrew I get gcc — Homebrew Formulae which suggests brew install gcc (on the system terminal, not R console)

1 Like

How did you install R? If you installed the r formula from Homebrew, then I suggest you remove it and install the CRAN build of R, which can use the binary packages from CRAN. You can also do this from Homebrew by installing the r cask:

brew install --cask r

Or, a great way to do that is to use the rig tool [1]. Which you can also install via Homebrew, btw.

To compile packages from source (which you rarely need with the CRAN build of R), you might need to install the XCode command line tools. You do not need to install gcc from Homebrew, CRAN R is configured

(Btw. if you add more specific tags to your question, e.g. "package installation" in this case, then there is a much higher chance that the people who can help you will see your question.)

[1] GitHub - r-lib/rig: The R Installation Manager

1 Like

I have a Mac and your suggestion worked! All I needed to do is installing the r cask. Thank you very much.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.