0

My problem on my MacOS is that I can use R from GUI (aka console, downloaded from CRAN), Terminal or from RStudio but I cannot have them function in the same way.

Specific example is I can use rJava on Terminal and RStudio but not on GUI. Similar stuff happens for Rmarkdown pdf outputs. I usually get errors from GUI but everything is fine on Terminal or RStudio. How do I update R GUI settings to the same as Terminal's?

ps. For instance R CMD javareconf command handled the Terminal R but not R GUI.

edit: It is not actually something that requires a minimal working example but let's try library(rJava) after installing it.

R Called from Terminal (same with RStudio)

No problems.

From Terminal

sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.5

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] C/UTF-8/C/C/C/C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.5.0

R GUI

enter image description here

sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.5

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.5.0 tools_3.5.0 

Some differences between Sys.getenv() are GUI has the following extra

LD_LIBRARY_PATH                :@JAVA_LD@
DYLD_LIBRARY_PATH              /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home/lib/server

Brief update: I was able to correct Rmarkdown situation by using this link and reading help by writing ?Startup on R console. Changed the Renviron file on my R.home()/etc/. But still no rJava.

berkorbay
  • 443
  • 7
  • 22
  • 1
    Please provide a minimal reproducible example. – Christoph Jun 10 '18 at 15:06
  • 1
    We'll need `sessionInfo()` output from all of the environments. the output of `/etc/profile` and `~/.bash_profile`. The output of `Sys.getenv()` from all environments too. Oh, you also should likely not post some of those bits as they may contain sensitive data (like tokens or credentials). `rJava` is notoriously difficult to get working in general. – hrbrmstr Jun 10 '18 at 15:31
  • I got half of my responses from this tiny FAQ item: https://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html#I-get-_0060_0060command-not-found_0027_0027-in-the-GUI-yet-it-works-in-the-Terminal-_002d_002d-why_003f but rJava problem persists. – berkorbay Jun 10 '18 at 15:34
  • Added info to the question. No bash_profile on this Mac somehow. – berkorbay Jun 10 '18 at 15:56
  • I don't know if it is still relevant but rJava's rJava.so file explicitly states jdk-9 while I have 10. @hrbrmstr – berkorbay Jun 10 '18 at 16:00

1 Answers1

0

For R Markdown problem, I managed to handle it by adding a ~/.Renviron file and defining PATH parameter with the value I got from Terminal's Sys.getenv() parameters.

The only thing that worked for rJava for High Sierra is the following answer (changed the version to 3.5 though)

https://stackoverflow.com/a/47685001/3608936

berkorbay
  • 443
  • 7
  • 22