Problems installing devtool package

Hey guys,
I hope everyone is safe in these difficult times with Covid-19.

I've run into a problem while trying to install a devtool package in RStudio using Anaconda on Mac. To install any package from GitHub, I need to first install `

install.packages(’devtools’)
when I run it I get the following list of errors.

configure: error: in `/private/var/folders/h5/r648_sjn21v3_78fw2q3q9dc0000gn/T/Rtmp9YS5Ai/R.INSTALL7f935d804da7/fs/src/libuv':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: *** [Makevars:29: libuv/Makefile] Error 77
ERROR: compilation failed for package ‘fs’
* removing ‘/Users/TheD/opt/anaconda3/envs/SDM/lib/R/library/fs’
* restoring previous ‘/Users/TheD/opt/anaconda3/envs/SDM/lib/R/library/fs’
Warning in install.packages :
  installation of package ‘fs’ had non-zero exit status
* installing *source* package ‘gh’ ...
** package ‘gh’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** byte-compile and prepare package for lazy loading
Error: object ‘cli_alert_info’ is not exported by 'namespace:cli'
Execution halted
ERROR: lazy loading failed for package ‘gh’
* removing ‘/Users/TheD/opt/anaconda3/envs/SDM/lib/R/library/gh’
Warning in install.packages :
  installation of package ‘gh’ had non-zero exit status
* installing *source* package ‘git2r’ ...
** package ‘git2r’ successfully unpacked and MD5 sums checked
** using staged installation
checking build system type... x86_64-apple-darwin17.7.0
checking host system type... x86_64-apple-darwin17.7.0
checking for gcc... x86_64-apple-darwin13.4.0-clang
checking whether the C compiler works... no
configure: error: in `/private/var/folders/h5/r648_sjn21v3_78fw2q3q9dc0000gn/T/RtmpcHeQsA/R.INSTALL80b67b6a816f/git2r':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘git2r’
* removing ‘/Users/TheD/opt/anaconda3/envs/SDM/lib/R/library/git2r’
Warning in install.packages :
  installation of package ‘git2r’ had non-zero exit status
ERROR: dependencies ‘gh’, ‘git2r’ are not available for package ‘usethis’
* removing ‘/Users/TheD/opt/anaconda3/envs/SDM/lib/R/library/usethis’
Warning in install.packages :
  installation of package ‘usethis’ had non-zero exit status
ERROR: dependencies ‘usethis’, ‘git2r’ are not available for package ‘devtools’
* removing ‘/Users/TheD/opt/anaconda3/envs/SDM/lib/R/library/devtools’
Warning in install.packages :
  installation of package ‘devtools’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/h5/r648_sjn21v3_78fw2q3q9dc0000gn/T/RtmpvA75TV/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done

After this, I cannot then install other packages that I need for running a species model distribution package called sdm

Please let me know if you have any idea on how can I solve this.
Thank you!

Hi, and welcome!

Please see the FAQ: What's a reproducible example (`reprex`) and how do I create one? Using a reprex, complete with representative data will attract quicker and more answers. Not needed for this type of question--there's enough to go on.

There are three possibilities that jump to the front of the rope line.

  1. Anaconda. I love Anaconda for many reasons, not the least of which is that it's a fabulous package manager for Python. Alas, it appears from many problems raised here, not so much for R.

  2. Missing XCode command line tools (OR a permissions problem), as evidenced by

The fix for the latter is to run with administrator privileges

$ sudo R
...
> install.packages(...)

after, of course, disabling Anaconda package manager ('tho I've never had to do this, since I've never used conda for R)

If it's that there's just no compiler, the fix is pretty simple. Download the free XCode app from the App Store, then

$ xcode-select --install

That may still not work depending on

  1. On macOS, packages sometimes fail to install, often with a non-zero exit status message. This is due to Apple's idiosyncratic compiler. The same packages will install on most Linux systems without trouble. Saint Simon Urbanek of the R Core Development Team takes on the brain damage required to recode the source to get around macOS's peculiar worldview for those in CRAN, but he can't bestow the same mercy on those still in development.

Some packages will successfully install through compilation from source, but many won't.

When installing if you are offered the option to install from source, it makes sense to try it once. But, if at first it doesn't succeed, in all likelihood it never will. It's usually only 7-10 days until a macOS binary is available

1 Like

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