I use Emacs and/or Aquamacs on a Mac system to edit the R, latex, and html code. After upgrading OS X to el Capitan, R stopped working (searching for program: no such file or directory, R). I was wondering if anybody encountered the same problem and found the solution.
-
3Have you tried re-installing R? – Gregor Thomas Oct 01 '15 at 20:04
-
Same here. All installed via homebrew. The surprising thing is most other homebrew packages and casks were left intact. But reinstalling seems to help. – bdecaf Oct 02 '15 at 07:01
-
I reinstalled R and Emacs, but it didn't help. – user2797533 Oct 02 '15 at 14:16
7 Answers
This is what I did and it solved the problem.
- re-install R (the latest version at the time of writing this post is 3.2.4)
- include (setq exec-path (cons "/usr/local/bin" exec-path)) in the .emacs. /usr/local/bin is where the command line R is soft linked.
Of course if the R command is not found in /usr/local/bin but somewhere else, you should change the path in step 2.

- 83
- 8
I had to re-install R and all the packages after upgrading. To be able to do this step easily, save your installed packages in a file before upgrading to El Capitan. The packages have not actually been removed, they reside in /Library/Frameworks/R.Framework/Versions/3.2/Resources/library (3.2 = version), so you can still find them, but some may be in your user library.
To save your list of packages:
my.packages = library()[[2]] write.table(my.packages,file="my.packages.txt", row.names=F, col.names = T)
Then upgrade, re-install from R-3.2.2.pkg (or latest), then read the text file in my.packages and use install.packages(my.packages, repos='http://cran.us.r-project.org') and you should be good to go.

- 11
- 2
Regarding R under "El Capitan", you do not necessarily have to re-install it. You can find out what happened by listing the directory
ls -l /Library/SystemMigration/History/Migration-<UUID>/QuarantineRoot/usr/bin
(where <uuid>
looks like 38CF2251-9593-48E9-BAA4-4880AA47E908
). This is where the OS upgrade put the links that used to live in /usr/bin
. Just create the same symlinks to R
and Rscript
as root:
cd /usr/local/bin
ln -s /Library/Frameworks/R.framework/Resources/bin/R R
ln -s /Library/Frameworks/R.framework/Resources/bin/Rscript Rscript
This assumes, of course, that /usr/local/bin
is in your PATH
.
New installations of R should be aware of the changes in El Capitan, cf. this R bug report.

- 8,948
- 5
- 48
- 51
Here is another solution: replace emacs with ``modified emacs''. It solves all the problems with Auctex (latex-preview-pane-mode) and R. It is also consistent with OS 10.11.
You can download it from: http://vgoulet.act.ulaval.ca/en/emacs/mac/

- 11
- 1
- 2
I had the same problem getting R to run on El Capitan. The problem is now solved. What follows is exacly what I tried. You might find some of the steps irrelevant but I've included them for the sake of completeness.
- Tried reinstalling it via homebrew (mentioined above) and got an incompatible message concerning el capitan.
- Loaded 'modified emacs' (mentioned above).
- Visited the following link: http://ftp.heanet.ie/mirrors/cran.r-project.org/bin/macosx/
then downloaded and installed: (i) R-3.2.2.pkg and ran the checksum command in Terminal as directed by the instructions. (ii) XQuartz 4. Then in terminal, typed R and it worked.
For the course I'm doing, other packages or libraries were needed. To load the package 'geonames, in Terminal type: install.packages(c("geonames"))
A message will appear asking to select a CRAN mirror. Also another window will open with a list of mirrors, click one and OK.
Similarly, the package 'UsingR' was loaded by: install.packages(c("UsingR"))
__end

- 1
- 1
I think the problem is that usr/bin
is no longer writeable. And that's where programs like R
and Rscript
lived. On my system, it looks like usr/bin
was moved to something like:
/Library/SystemMigration/History/Migration-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/QuarantineRoot/usr/bin
I suppose you can add that quarantined folder to your path as on my system everything seems to be working fine if executed from there.

- 33
- 3
I had the same problem. I'm not sure what's changed in El Capitan but adding the path to the R binary (/usr/local/bin
on my system) to the exec-path in my .emacs
file fixed the issue for me.

- 6,089
- 11
- 42
- 47