I am currently running R 3.3.1 in emacs 25.1.1, ESS 16.10, and polymode 20160805.448 installed via MELPA on Mac OS Sierra. Whenever I try to open an interactive R console using M-x R, it freezes immediately upon startup and I have to force quit emacs.

The bottom bar says "ess-tracebug mode enabled" and the R console initially runs if(identical(getOption('pager'), file.path(R.home('bin'), 'pager'))).

My .emacs file has the following code related to ESS:

;ESS mode configuration
(autoload 'R-mode "ess-site.el" "ESS" t)
(add-to-list 'auto-mode-alist '("\\.R$" . R-mode))
(setq inferior-R-program-name "/usr/local/bin/R")

;;R stuff
(setq ess-eval-visibly-p nil)
(setq ess-ask-for-ess-directory nil)
(require 'ess-eldoc)

;;compile the first target in the Makefile in the current directory using F9
(global-set-key [f9] 'compile)
(setq compilation-read-command nil)

(require 'poly-R) ;; Load polymode for Rmd and Rnw
(add-to-list 'auto-mode-alist '("\\.Snw" . poly-noweb+r-mode))
(add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
(add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))

;; The following four lines set C-; to automatically add " -> " in ESS,
;; and causes _ to insert a normal underscore.
(setq ess-S-assign-key (kbd "C-;"))
(ess-toggle-S-assign-key t) ; enable above key definition
;; leave my underscore key alone!
(ess-toggle-underscore nil)
;; Map C-' to the pipe operator %>%
(defun then_R_operator ()
  "R - %>% operator or 'then' pipe operator"
  (just-one-space 1)
  (insert "%>%")
  (just-one-space 1))
(define-key ess-mode-map (kbd "C-'") 'then_R_operator)
(define-key inferior-ess-mode-map (kbd "C-'") 'then_R_operator)

EDIT: Also I'm not sure if this helps, but I copied a .emacs file from a computer with a functioning R mode to try to fix this issue and it still failed.

**EDIT 2: Completely copied over a .emacs and a .emacs.d from the same working computer. Upon startup, the first line on the frozen computer is if(identical(getOption('pager'), file.path(R.home('bin'), 'pager'))), but on the original, working computer, it is:

 if(identical(getOption('pager'), file.path(R.home('bin'), 'pager'))) # rather take the ESS one
+       options(pager='cat')
> options(STERM='iESS', str.dendrogram.last="'", editor='emacsclient', show.error.locations=TRUE)
  • Do you have the same problem if you start Emacs without your init file (emacs -Q)?
    – Dan
    Commented Nov 3, 2016 at 16:34
  • If I start Emacs without my init file, then I can't open R at all because M-x R isn't enabled. Commented Nov 3, 2016 at 16:45
  • 1
    Evaluate the lines in your init file one by one from the top. Just the first one (that loads R) should be enough. Alternately, just evaluate (require 'ess-site).
    – Dan
    Commented Nov 3, 2016 at 16:48
  • I'm attempting to do this by following the instructions here, but can't seem to evaluate lines one by one. Commented Nov 3, 2016 at 16:57
  • I just tried evaluating it line by line. Just doing (require 'ess-site) and trying M-x R froze with the same error as in the original post. Commented Nov 6, 2016 at 22:51

1 Answer 1


I had the same issue but now it should be fixed in the development version.

  • It works for me now too once I updated it. Thanks! Commented Mar 10, 2017 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.