Sed directory not found when starting R with -e flag

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 has recently moved the ENV folder to a new path (see here ). I know that I can easily link the new sed dir to fix the problem, but I wanted to know if there is a better workaround / fix (and ultimately, if that is fixed in the R source code).

+9
r homebrew sed
source share
3 answers

This is because brew changed its paths in this commit , so if you ran brew update in the last 4 days, this is what caused the crash.

Credit is sent to blindjesse for the response, which is located at brew reinstall -sr .

I ran into some other problems when I tried this. I did not have X11 and ran into a conflict with tcl-tk , which meant that it caused some other compilation failures:

  • I installed XQuartz from https://www.xquartz.org
  • Designated it in my home folder ln -s /opt/X11/include/X11 /usr/local/include/X11 (note that your homebrew directory may be different)
  • brew install homebrew/dupes/tcl-tk brew link --overwrite --force tcl-tk; brew unlink tcl-tk
  • brew reinstall -sr

And then it worked for me. I think that after updating the bottle r this problem should disappear, but at the moment this is what I should have done.

+10
source share

Updated to Sierra, tried the commands above, as well as the following areas: https://github.com/Homebrew/homebrew-science/issues/4338 . After I also reinstalled the R kernel, following the instructions here: https://github.com/IRkernel/IRkernel , everything worked again. Oy vey.

To reinstall the R kernel, run 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 
+1
source share

Instead of having a hard sed path path, a simple workaround is to edit the R script and change line 193 with

 SED=$(which sed) 
0
source share

All Articles