Since this adds this path to the beginning of $PATH, an env variable, bash looks here first where it finds the newer version first, and stops looking. To my understanding, this ensures that bash looks here for R (and anything else), then moves on to the other paths in PATH. export PATH="/Library/Frameworks/R.framework/Resources:$PATH"
(If you do not know already how to do this, then ignore this solution.) Do so as follows. You can choose a different alias name to "Rv340".Ī second more permanent solution for opening the same version of R in Terminal is as follows.Ĭopy the path as showing in R.app in response to the R.home() command above, and add that path to PATH in your. (This is so the changes to the env above are incorporated in the new terminal session). I then save the changes and exit this terminal session. alias Rv340='/Library/Frameworks/R.framework/Resources/bin/R' (If you do not already know how to do this, then best not use this solution.) Make an alias.īeing in my home directory in Terminal I open. My last solution I think may be best, adding to mko's solution. One could also make an alias of it and put it on your desktop for easy future starts. So add /bin/R to enter /Library/Frameworks/R.framework/Resources/bin/RĮntering and pressing return will start R from this version.Īlternatively, one can find this file and icon in the GUI Finder, lead by the above result, and just double click on it, and it will open Terminal and a session with R running for you. From the result above, and checking the directory structure a little further to find this R file.įinding the significant R file enables me to edit an extension of the above path shown in the R.app. For those not yet familiar with Terminal and bash, not such a novice solution. I could update the anaconda version, however, I would prefer not to as as other elements of the anaconda package my depend on this older version of R. All the same here are some novice solutions. How can I ensure I access the same version in Terminal as I do in the R.app?įor someone familiar with bash, and how the whole bash command system works I am sure there is a well constructed command. So I have two different versions of R, and Terminal accesses a different version to R.app.
In Terminal - the R version 3.3.2 is accessed in the Anaconda package, again in the top level directory. In R.app - the R version 3.4.0 is accessed in the top directory (not my user folder): R.home() To learn where the R files are that are being accessed - in Terminal after starting R, and in R.app, type:
I can only assume that with a fresh install of the latest R, R will work for you in Terminal. However it will not update an installation of R installed by the anaconda package. To my understanding, reading support docs, if you have an older version of R it will update that. I found this latest install version 3.4.0 installs R for access in Terminal, and also installs R.app as part of the package. I have done a fresh update install of R from the R.org cran site as part of seeking an answer to your question. I hope the extra detail helps, and I appreciate the responses.Īn answer for those not that familiar with Terminal and Bash. I'm fine with removing and re-installing R if it's easiest to start from square one. Generally, I've been working in RStudio, but I'd still like to access R from the terminal and also to find where things are located. Is it possible, I only have R.app installed but not R? Perhaps that's the reason I'm getting the 'command not found' when typing "R" into the terminal? I can locate the GUI in my applications and open it.
Here is the output from "echo $PATH": for the installation, I believe I downloaded it directly from a while ago. So, I'm running Sierra, and when I type "r" or "R" at the terminal, I get "-bash: R: command not found." If I type, "which R" in the terminal I do not get any output. Thanks for any help Edits after receiving comments Is it necessary to edit the PATH in my bash profile? If so, how do I give the correct location of R? I thought I could just type "R" from the command line as I do with "python", but that doesn't work. I have Rstudio and the standalone R app installed.
I've searched the web, and I'm still unclear on how to run R from the Mac terminal.