sh: rm: command not found sh: mv: command not found

I am trying to install a package from github. I kept getting an error.

sh: rm: command not found
sh: mv: command not found
Warning in system(paste("mv -f", shQuote(instdir), shQuote(dirname(final_instdir)))) :
error in running command
ERROR: moving to final location failed

I have my PATH variable correct

Sys.getenv('PATH')
[1] "/usr/local/bin/:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin"

also I am able to run
system("mv")
usage: mv [-f | -i | -n] [-v] source target
mv [-f | -i | -n] [-v] source ... directory

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

Any help?

Have you tried using devtools::github_install([USER][REPOSITORY]? See the description

Hi @technocrat.

I tried that and get the following error

devtools::install_github("ohdsi/DatabaseConnectorJars")
Downloading GitHub repo ohdsi/DatabaseConnectorJars@master
:heavy_check_mark: checking for file ‘/private/var/folders/22/pz8hk02x2hj985j4klbz5gkm0000gp/T/Rtmp9ApTNq/remotes3f7e1ba8cc39/OHDSI-DatabaseConnectorJars-e4a152e/DESCRIPTION’ ...
Error in system2("cp", "--version", stdout = TRUE, stderr = FALSE) :
error in running command
Execution halted
sh: rm: command not found
Error: Failed to install 'DatabaseConnectorJars' from GitHub:
System command error, exit status: 1, stdout + stderr:
E> * checking for file ‘/private/var/folders/22/pz8hk02x2hj985j4klbz5gkm0000gp/T/Rtmp9ApTNq/remotes3f7e1ba8cc39/OHDSI-DatabaseConnectorJars-e4a152e/DESCRIPTION’ ... OK
E> Error in system2("cp", "--version", stdout = TRUE, stderr = FALSE) :
E> error in running command
E> Execution halted
E> sh: rm: command not found

In the RStudio console tab, using

system("echo $PATH")

Created on 2019-10-21 by the reprex package (v0.3.0)

do you get

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Library/TeX/texbin:/usr/local/go/bin:/opt/X11/bin

with /bin?

Yes

system("echo $PATH")
/usr/local/bin/python3.6:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin

However, I entered following commands and it seems like RStudio can not find the RTools.

pkgbuild::has_build_tools()
[1] FALSE
pkgbuild::find_rtools(debug = TRUE)
[1] FALSE

I have XCode installed.

Ah! Stupid me, you're on Windows.

Use the search tool for RTools to see if there are any helpful answers. If not, let me know and I'll try to enlist the help of someone with direct experience.

Hi @technocrat

Sorry, I am in Mac OS Mojave

From memory, RTools is Window's specific. I'm trying

devtools::install_github("ohdsi/DatabaseConnectorJars")

but it' s hung on installing rjava; I'll get back if I get over that hump.

@technocrat I was able to solve the problem. The problem was R Studio was unable to find the command line tools. I solved this problem following the instructions in this post,
https://thecoatlessprofessor.com/programming/cpp/r-compiler-tools-for-rcpp-on-macos/

Specifically, I followed the following steps.

CFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CCFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CXXFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CPPFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
-I/usr/local/include

3 Likes

Congratulations! Do future pilgrims a favor and mark your own answer as the solution.