cannot install package: error: sh: rm: command not found

I'm unable to install an R package. I'm on macOS Mojave, latest verion of R (installed yesterday) running it in Rstudio. I think my main issue is:

sh: rm: command not found

but below is the full error message.

I've been using R for.... 3 days?... so I know very little but I'm trying to understand as I troubleshoot this. My understanding is the R is trying to call a command outside of R but isn't able to? Could someone point me in the right direction to understand and solve this problem?

Thanks!

Full test of my command and the output:

install.packages("NBPSeq")
Installing package into ‘/Users/ben/Library/R/3.6/library’
(as ‘lib’ is unspecified)
Package which is only available in source form, and may need compilation of
C/C++/Fortran: ‘NBPSeq’
Do you want to attempt to install these from sources? (Yes/no/cancel) yes
installing the source package ‘NBPSeq’

trying URL 'https://cran.rstudio.com/src/contrib/NBPSeq_0.3.0.tar.gz'
Content type 'application/x-gzip' length 210592 bytes (205 KB)

downloaded 205 KB

  • installing source package ‘NBPSeq’ ...
    ** package ‘NBPSeq’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** libs
    sh: make: command not found
    Warning in system(cmd) : error in running command
    ERROR: compilation failed for package ‘NBPSeq’
  • removing ‘/Users/ben/Library/R/3.6/library/NBPSeq’
    sh: rm: command not found
    Warning in install.packages :
    installation of package ‘NBPSeq’ had non-zero exit status

Do you have xcode installed in your system? You need it for compiling packages on MacOS

xcode-select --install

Here are some installation instructions

Thank you for your reply. I had tried this, but it's already installed. I get the following error:

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

echo $PATH gives me:
/usr/local/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

R is located is usr/bin while "make" is located in usr/local/bin. I believe make is part of Xcode, correct? Does that mean R and Xcode commands are in different locations and cannot be used together?

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