Running system command from R console cannot locate installed programs since upgrading to Mac OSX 10.10

前端 未结 2 779
难免孤独
难免孤独 2020-12-09 21:26

I have been having some weird issues with R (3.1.1) and RStudio (0.98.1079) and I suspect that it is due to the fact that these programs are not longer referencing the right

相关标签:
2条回答
  • 2020-12-09 21:49

    Yosemite has a bug wherein some environment variables, including PATH, appear twice in a program's environment with different values. For instance, you might notice that Sys.getenv("PATH") will show you one PATH, and system("echo $PATH") will show you an entirely different one.

    I expect that most of your problems are due to this bug.

    There are a few workarounds you can try immediately:

    1. You can manually forward PATH yourself. Try this:

      > system2("man", "pdflatex", env=paste0("PATH=", Sys.getenv("PATH")))
      
    2. Or, you can start RStudio from Terminal:

      $ open /Applications/RStudio.app
      

    Both the R and RStudio engineers have implemented workarounds in the last few days. R (as of 3.1.2) and RStudio (as of 0.98.1087) should behave as you'd expect.

    0 讨论(0)
  • 2020-12-09 22:06

    There are a host of questions about similar problems. All of them appear to come up when you update OS X to either Yosemite or Sierra with an older version of R already installed.

    The easiest solution is to completely uninstall R (note the comments about using which R !), and then to install it again.

    This also solves problems such as R showing different version numbers in terminal and the GUI.

    0 讨论(0)
提交回复
热议问题