/usr/bin/env: RScript: No such file or directory | After recent R-3.0.1. installation.

user2555016 picture user2555016 · Jul 5, 2013 · Viewed 13.3k times · Source

I am a bit lost when dealing with installing and using R. I installed R 3.0.1 from source and did the ./configure, make, make check, and make install as suggested. However I tried running R but it said that R wasn't in the /usr/bin folder. So I then copied the entire R-3.0.1/bin directory into my /usr/bin directory using cp. Now I'm getting a few errors regarding /usr/bin/env when trying to use RScript on a hello_world.R script I wrote from the O'Reilly R In a Nutshell book I store in a file hello_world.R the contents are below:

#! /usr/bin/env RScript
print("Hello World!");

Simple enough, but when I try to load it I get the following error:

$ ./hello_world.R
/usr/bin/env: RScript: No such file or directory

I'm not sure if this is a PATH problem or something, but when I search in my /usr/bin directory I do see the RScript file in there along with (R, BATCH, and the others associated with R programming language). Any help is greatly appreciated. Cheers.

Answer

Vyke picture Vyke · Aug 12, 2013

You may be using an invalid command line option for Rscript in your shebang line.

For instance ...

#!/usr/bin/env RScript --vanilla

remove "--vanilla" (or other offending option) and rerun your script

#!/usr/bin/env RScript

I know you didn't put this in your example, but the solution may help others searching for the same issue.