Disable GUI, graphics devices in R

r

Solution

I had this exact question and wanted a way to do it without changing my existing code. I usually run with graphics support but sometimes I'll run a script on the server for a larger dataset and then I just want the plots to be output somewhere automatically.

In Dirk's answer Ian Fellows gives the simple solution. On the command line in R type:

options(device=pdf)

And then any plots will be written to the current directly to an Rplots.pdf file.

If you want the files to not be plotted at all then use

options(device=NULL)

Problem

Is there an easy way to turn of all GUI elements in R and run it solely from the command line on OSX? I'm trying to replicate the behavior of a remote linux terminal on my OSX machine. Thus plot() should just save a file and things like CRAN mirror selection should be text, not a Tk interface. I'm having trouble finding where to set this behavior.

Original source