Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

zsh: command not found: R on terminal using Big Sur Mac

I installed R from official cran website and i can run R from the Rstudio but when i try to use R from the terminal, I get the following results:

(base) ege@Eges-MBP ~ % R  
zsh: command not found: R
(base) ege@Eges-MBP ~ % RScript 
zsh: command not found: RScript

How can i enable the command R and run RScript from terminal on my mac?

like image 833
Ege Can Avatar asked Apr 01 '21 10:04

Ege Can


1 Answers

This is possibly due to a bug with the current version of CRAN's R installation package (present as of version 4.0.5), that affects certain versions of Big Sur. I've answered this question here: R: command not found

In short, if running uname -r gives you a release number greater than 20, then you may need to manually create symbolic links that the package installer failed to.

In short:

    sudo -s
    mkdir -p /usr/local/bin
    cd /usr/local/bin
    rm -f R Rscript
    ln -s /Library/Frameworks/R.framework/Resources/bin/R .
    ln -s /Library/Frameworks/R.framework/Resources/bin/Rscript .
like image 67
Yuri Broze Avatar answered Sep 28 '22 05:09

Yuri Broze