WestCoastProjects
WestCoastProjects

Reputation: 63201

Why is R "hashed" to ${USER_HOME}/miniconda/bin/R?

I do not know how or why miniconda has hijacked my R environment. I just re-installed R to try to move past this situation. But R was still pointed to miniconda version:

$which R
/Users/steve/miniconda3/bin/R

So I tried to just shove that out of the way:

(base) 04:54:34/python $mv ~/miniconda3/bin/R ~/miniconda3/bin/R.miniconda

The new version of R "seems" to be the active one now:

(base) 04:55:21/python $which R
/usr/local/bin/R
(base) 04:55:24/python $ll $(which R)
-rwxrwxr-x  1 root  admin  9156 Jun 23 16:48 /usr/local/bin/R

However something funny happens when trying to actually run R:

$R
-bash: /Users/steve/miniconda3/bin/R: No such file or directory

I do not understand why the moved R is still being referenced. Is there some kind of alias or redirection for R ?

$type R
R is hashed (/Users/steve/miniconda3/bin/R)

Where is this defined? How do I change that to the correct /usr/local/bin/R ?

Upvotes: 2

Views: 102

Answers (1)

WestCoastProjects
WestCoastProjects

Reputation: 63201

I found out the "redirection" is actually due to the workings of which. This answer describes the situation https://stackoverflow.com/a/39009275/1056563

You probably needed to run hash -r in your session (or rehash if using zsh) to update your executables on PATH for the which command. A new terminal session would also fix the problem.

Upvotes: 2

Related Questions