How to solve problem with installing the caret package?

Viewed 51

I am having trouble with installing the package caret. I have seen it has been a common issue for several users, but I get a different error than most of them, who needed to install the dependencies.

The R version I am using is R.4.0.4

Here is the error I get:

* installing *source* package ‘caret’ ...
** package ‘caret’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘caret’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/caret’
Warning in install.packages :
  installation of package ‘caret’ had non-zero exit status

How do I resolve this error?

1 Answers

Apparently, it is a specific problem with Mac.

Open Terminal, and run the following:

xcode-select --install

This will download and install the Command Line Tools package and fix the problem.

You do not need XCode, you can install only the Command Line Tools here, it is about 130 MB.

If the above alone doesn't do it, then also run:

sudo xcode-select --reset"

Some of this answer was sourced from another question on the Stack Exchange network. See whole set of exchanges here.

Related