[R] a way to interrupt a stuck R session on OSX

Josh Tolley eggyknap at gmail.com
Mon Jan 14 06:30:11 CET 2008

On Jan 13, 2008 8:02 PM, Day, Roger S. <day at upci.pitt.edu> wrote:
> Discovered by accident:
> If your R session has become unresponsive to escape presses etcetera,
> you can try this.
> Open a terminal window, run the command
> ps -ax | grep R.app
> Note the process ID number in the first column.  Say it's 1234.
> Then run
> kill -4 1234
> The key is that the signal you are sending to R.app is "4".
> The Console will now ask you how you want to exit.
> This at a minimum gives you a chance to save any window content,
> since it's a nicely threaded application.
> Once (of 2 times) I could also cancel out of the dialog and resume the
> session.

What signal is signal 4 on your OS (or more specifically, what signal
is it that R responds to in this manner)? If I understand correctly,
different OS's supporting kill(1) vary in the interpretation of
numerically specified signals, though I can only report this as
hearsay, and not provide specific examples. Nevertheless, folks in my
little circle tend to use kill -SIGTERM, kill -SIGQUIT, etc. rather
than numeric signal specifiers just in case kill(1) behaves
differently than they expect.

- Josh

More information about the R-help mailing list