0

I try to automate a simple workflow. Its a oneliner in Terminal, nothing really special. And also tested via Terminal - it works perfect.

During this workflow R should be started via Automator (run a shell script). But it's impossible to start R via Automator (run shell script). Interesting: It is also impossible to run "psql" via automator-shell script, but "Python" works.

Whats the secret behind that? (R & psql runs perfect via normal Terminal.)

Teletubbi-OS X
  • 391
  • 1
  • 3
  • 13
  • If you don't need an interactive session, use `Rscript -e 'library(myLibrary);mySuperScript'`. – fxi Jul 17 '14 at 07:46
  • possible duplicate of [Run Shellscript from Mac Automator](http://stackoverflow.com/questions/25161100/run-shellscript-from-mac-automator) – tripleee Aug 07 '14 at 04:20

1 Answers1

0

In (mac) OS X, start an automator process with Run Shell Script action.

Try with this command :

Rscript -e "system('say hello')"

It should work.

Example with shiny app :

Rscript -e "library(shiny);runExample('01_hello',launch.browser = T)"
fxi
  • 607
  • 8
  • 16
  • Nearly perfect! With **Rscript** the browser start - and nothing happens. From Terminal, perfect. I run this command: `Rscript -e "shiny::runApp(('/Users/ABC/Documents/Git/RShiny/shinyapp'),launch.browser=TRUE))" ` Automator uses a other shall than the "normal" $BASH. But which one? – Teletubbi-OS X Jul 19 '14 at 10:36
  • I don't know what's going on with your shiny app. Try the example in my answer : does it work ? In automator shell script, is the shell set to `/bin/bash` ? – fxi Jul 19 '14 at 11:34
  • `"dyld: Library not loaded: /usr/local/lib/gcc/x86_64-apple-darwin13.2.0/4.8.3/libgfortran.3.dylib Referenced from: /usr/local/Cellar/r/3.1.1/R.framework/Versions/3.1/Resources/lib/libR.dylib Reason: image not found" ` – Teletubbi-OS X Jul 22 '14 at 11:27
  • It's the output of the shiny example ?? It's look like R doesn't find gfortran libraries. If you type "which gfortran" in your terminal, do you have something ? If not, maybe you should install gfortran with [homebrew](http://brew.sh/) : `brew install gfortran`. But, there maybe another problem, unrelated with your first question. – fxi Jul 22 '14 at 12:48
  • Terminal output for "which gfortran": `/usr/local/bin/gfortran` – Teletubbi-OS X Jul 22 '14 at 13:45
  • Ok.. how did you install `R` ? did you upgraded xcode ? have you installed `gfortran` via `brew` ? You have maybe a problem of dynamic link. Try to set a fallback library path `export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/lib/gcc/`. If it's not better, unset it with `unset DYLD_FALLBACK_LIBRARY_PATH`. If nothing works, try to reinstall r : [r+gfortran+homebrew install](http://davidsimpson.me/2013/02/26/installing-r-on-os-x/)... – fxi Jul 22 '14 at 15:37
  • Or ask a new question, because it seems to be unrelated to this question :) – fxi Jul 22 '14 at 15:38