leonfrench
leonfrench

Reputation: 293

R, macosx, Rscript Fatal error: creating temporary file for '-e' failed

I'm running R 3.6.0 on Mac osx 10.11.6 (El Capitan) and get an "Fatal error: creating temporary file for '-e' failed" error when calling Rscript via system().

test_cmd <- "/Library/Frameworks/R.framework/Resources/bin/Rscript -e 'print(\"Hello\")'"
system(test_cmd, intern = TRUE)

That returns this error:

[1] "Fatal error: creating temporary file for '-e' failed"
attr(,"status")
[1] 2
Warning message:
In system(test_cmd, intern = TRUE) :
  running command '/Library/Frameworks/R.framework/Resources/bin/Rscript -e 'print("Hello")'' had status 2

I get this error when trying to make a cluster via future, which led me to this specific example.

future::makeClusterPSOCK(1, outfile = NULL, verbose = TRUE)

That also calls Rscript and fails with the same error.

Also, if I call Rscript from the command line it runs fine.

Upvotes: 1

Views: 298

Answers (1)

leonfrench
leonfrench

Reputation: 293

I sorted it out - I had set the TMPDIR variable in my .REnviron file about a year ago while trying to fix something else I guess. That folder wasn't valid and was only used when a system call was ran. Upgrading R to 3.6.1 didn't fix this as that file stayed there.

Solution: delete the offending line in .REnviron in your home folder

Upvotes: 1

Related Questions