In the mac terminal, we can start an R session by simply typing R.
e.g.
s@MacBook-Pro Desktop % R
R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.0 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
This opens version 4.0.2 on my mac, but I have other versions installed (I can see them via RSwitch).
How can I open a different version of R from the mac terminal? (and just to be clear, this isn't a question about how to use a different R version in RStudio)
Notes
sudo find /usr -path "*/bin/R" -print
/usr/local/bin/R
ls -l /usr/local/bin/R*
lrwxr-xr-x 1 root wheel 47 19 Jul 02:51 /usr/local/bin/R -> /Library/Frameworks/R.framework/Resources/bin/R
lrwxr-xr-x 1 st admin 37 15 Apr 22:41 /usr/local/bin/Redirect -> ../Cellar/xerces-c/3.2.3/bin/Redirect
lrwxr-xr-x 1 root wheel 53 19 Jul 02:51 /usr/local/bin/Rscript -> /Library/Frameworks/R.framework/Resources/bin/Rscript
find / -path "*/bin/R" -print 2> /dev/null | grep "R$"
/usr/local/bin/R
/Library/Frameworks/R.framework/Versions/3.4/Resources/bin/R
/Library/Frameworks/R.framework/Versions/3.2/Resources/bin/R
/Library/Frameworks/R.framework/Versions/3.0/Resources/bin/R
/Library/Frameworks/R.framework/Versions/3.6/Resources/bin/R
/Library/Frameworks/R.framework/Versions/4.0/Resources/bin/R
/System/Volumes/Data/usr/local/bin/R
/System/Volumes/Data/Library/Frameworks/R.framework/Versions/3.4/Resources/bin/R
/System/Volumes/Data/Library/Frameworks/R.framework/Versions/3.2/Resources/bin/R
/System/Volumes/Data/Library/Frameworks/R.framework/Versions/3.0/Resources/bin/R
/System/Volumes/Data/Library/Frameworks/R.framework/Versions/3.6/Resources/bin/R
/System/Volumes/Data/Library/Frameworks/R.framework/Versions/4.0/Resources/bin/R
/System/Volumes/Data/Users/st/anaconda3/bin/R
/System/Volumes/Data/Users/st/anaconda3/pkgs/r-base-3.5.1-h539fb6c_1/bin/R
/System/Volumes/Data/Users/st/anaconda3/pkgs/r-base-3.5.1-h539fb6c_1/lib/R/bin/R
/System/Volumes/Data/Users/st/anaconda3/lib/R/bin/R
/Users/st/anaconda3/bin/R
/Users/st/anaconda3/pkgs/r-base-3.5.1-h539fb6c_1/bin/R
/Users/st/anaconda3/pkgs/r-base-3.5.1-h539fb6c_1/lib/R/bin/R
/Users/st/anaconda3/lib/R/bin/R
Update
Looks like after finding all R binaries with find / -path "*/bin/R" -print 2> /dev/null | grep "R$" we should be able to open any of them. But (example)
/Library/Frameworks/R.framework/Versions/3.4/Resources/bin/R
opens 4.0.2. And
/System/Volumes/Data/Library/Frameworks/R.framework/Versions/3.4/Resources/bin/R
also opens 4.0.2.
I cannot work out why?