9

When I try to run the following command: R --slave --no-save --no-restore -e "print('foo')"

I get: /usr/local/bin/R: line 193: /usr/local/Library/ENV/4.3/sed: No such file or directory ERROR: option '-e' requires a non-empty argument

Apparently brew recently moved the ENV folder to a new path (see here). I know I can easily symlink the new sed dir to fix the issue but I wanted to know if there is a better workaround / fix (and eventually if this will be fixed in the R source code).

Climbs_lika_Spyder
  • 6,004
  • 3
  • 39
  • 53
petobens
  • 1,330
  • 1
  • 12
  • 23

3 Answers3

10

This happens because brew has changed it's paths in this commit so if you've run brew update in the last 4 days, this is what has caused the breakage.

Credit goes to blindjesse for this answer, which is to brew reinstall -s r.

I ran into some other issues when I tried this though. I didn't have X11 installed and I had a conflict with the tcl-tk which meant that it caused some other failures when it was compiling so:

  1. I installed XQuartz from https://www.xquartz.org
  2. Symlinked it to my homebrew folder ln -s /opt/X11/include/X11 /usr/local/include/X11 (note that your homebrew directory may be different)
  3. brew install homebrew/dupes/tcl-tk brew link --overwrite --force tcl-tk; brew unlink tcl-tk
  4. brew reinstall -s r

And then it worked for me. I think once the r bottle is upgraded this issue should disappear but for the moment this is what I had to do.

cdaloisio
  • 1,516
  • 1
  • 12
  • 8
1

Upgraded to Sierra, tried the commands above and also the directions here: https://github.com/Homebrew/homebrew-science/issues/4338. After I also reinstalled the R kernel following the instructions here: https://github.com/IRkernel/IRkernel, things started working again. Oy vey.

To reinstall the R kernel, start R in the terminal and enter the following:

install.packages(c('repr', 'IRdisplay', 'crayon', 'pbdZMQ', 'devtools'))
devtools::install_github('IRkernel/IRkernel')
IRkernel::installspec()  # to register the kernel in the current R installation
Andrew Pederson
  • 147
  • 1
  • 9
0

Rather than having sed's path hardcoded, a simple workaround is to edit the R script and to change line 193 with

SED=$(which sed)
Skippy le Grand Gourou
  • 6,976
  • 4
  • 60
  • 76