I'm trying to run R from iTerm on an OSX computer (OSX 10.11.6). When I enter
This is likely due to the
PATH variable preferring
/usr/local/bin. I'm giving you a few options here to help understand why it is happening.
Let's assume your
PATH looks like this:
You could modify
PATH to move
/usr/local/bin or remove it from
PATH completely. The downside is that if you rely on other binaries in
~/miniconda2/bin they will no longer be found when executing them by name.
Another option would be to move
~/miniconda/bin/R out of the way, for example using
mv ~/miniconda/bin/R ~/miniconda/bin/R-miniconda
Afterwards R will be run from the next location in
$PATH, but if you update miniconda2 it may return.
Finally, you could make sure that there is an R executable in something that is further up the
$PATH. This is probably the easiest and most effective option.
First, make sure you have a
bin folder in your home directory. If this is not the case, create it and then restart the terminal. The restart should cause the code in
~/.profile to add that folder to your
$PATH. You can verify by doing
echo $PATH. In the above example the path already contains
/Users/me/bin at the very top.
Next, create a soft link to the R binary in the newly created folder:
ln -s /usr/local/bin/R ~/bin/R
You should now be able to execute R, which will prefer the softlink created, which will execute the one you like. If it does not work right away execute
hash -r or restart the terminal.