7

I have installed R from Home-brew in macOS:

brew install R

Right now, though, I would need to switch the version and install a specific R version. For this reason I tried, without success, to install R-3.5.2 in both this ways:

brew install R-3.5.2
brew install R@3.5.2

This is what I get:

Error: No available formula with the name "r@3.5.2" 
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.

Do you have any idea? Thanks : )

camille
  • 16,432
  • 18
  • 38
  • 60
luca tucciarone
  • 111
  • 1
  • 8
  • If you only need this to test something on an older version, I would recommend https://rstudio.cloud/ – JBGruber Nov 12 '19 at 11:15
  • Thank you for answering. I actually need to downgrade and keep the older version. – luca tucciarone Nov 12 '19 at 11:40
  • Although it is technically achievable with `brew`, what you really want is to have virtual environments. I would recommend installing and managing shell-level software using `conda` in separate environments. – Eli Korvigo Nov 12 '19 at 11:40
  • I do like working in R-studio. Do u think the virtual envs are compatible with that? Btw, right now I would prefer just switching the version from the latest to 3.5.2. Do you know how to do it? – luca tucciarone Nov 12 '19 at 12:02
  • Nobody? Please! I need to install this old version : ( – luca tucciarone Nov 25 '19 at 15:24
  • Maybe it is an idea to use a docker container from rocker/rstudio. Have a look [here](https://hub.docker.com/r/rocker/rstudio/). They still have some old version. You can use it through your web browser and you'll have the same interface as Rstudio. – ricoderks Dec 02 '19 at 13:53
  • This is an option I want to take into consideration (Thank you very much) but for the moment I would just like to downgrade. In the future I may need to use different instances of R with different versions. For now I am settled on the 3.5.2 : ( – luca tucciarone Dec 02 '19 at 15:54

1 Answers1

2

Disclaimer: I don't have a Mac available for testing.

Here you can find a quite useful tutorial on how to install old versions via homebrew, here is another one.

For R this translates to:

git clone https://github.com/Homebrew/homebrew-core.git
cd homebrew-core/
git log master -- Formula/r.rb

which yields the following commits for R 3.5.2:

commit e66b3a288ee5e68c3c04e95705b7311c9f76bdf2
Author: ...
Date:   Sun Jan 13 10:59:16 2019 +0000

    r: update 3.5.2_2 bottle.

commit a2ced14fabb30732b2b6f22919105ac66085e78c
Author: ...
Date:   Tue Jan 8 10:36:41 2019 +0100

    r: revision for readline

commit 61c60b0c4c237a0ada3ab8b83b934566b101ee67
Author: ...
Date:   Sat Jan 5 04:06:37 2019 +0000

    r: update 3.5.2_1 bottle.

commit f9325e5e63ba812d1a2d5fd405811e313f782ff1
Author: ...
Date:   Fri Jan 4 17:36:34 2019 +0100

    r: build with openblas

commit 70aca0ac8f83459ff1ce18c1ea3f462b49434eb2
Author: ...
Date:   Fri Dec 21 06:48:02 2018 +0000

    r: update 3.5.2 bottle.

commit d344d5b57d0c8b0bf0ef6b3052e6bed551b37b47
Author: ...
Date:   Fri Dec 21 14:31:14 2018 +0800

    r 3.5.2

    Closes #35321.

As an alternative you can search for commits via URL (Please see this comment):

https://github.com/Homebrew/homebrew-core/search?q=r%203.5.2&type=commits


Accordingly you should be able to install R 3.5.2 via (Latests R 3.5.2 commit):

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/e66b3a288ee5e68c3c04e95705b7311c9f76bdf2/Formula/r.rb

or:

brew install https://github.com/Homebrew/homebrew-core/raw/e66b3a2/Formula/r.rb

brew switch and brew pin as mentioned in this article might also be of interest.

ismirsehregal
  • 30,045
  • 5
  • 31
  • 78
  • Thank you very much! We are almost there. I was finally able to install R 3.5.2 following your guide. I have also used brew switch and brew pin as u suggested. The only thing is that now I cannot use it for some reasons. This is the error: dyld: Library not loaded: /usr/local/opt/openblas/lib/libopenblasp-r0.3.5.dylib Referenced from: /usr/local/Cellar/r/3.5.2_2/lib/R/lib/libR.dylib Reason: image not found Abort trap: 6 – luca tucciarone Dec 03 '19 at 18:11
  • [This](https://stackoverflow.com/a/50634728/9841389) might help. – ismirsehregal Dec 03 '19 at 18:33
  • 1
    Sadly this doesn't work anymore. Homebrew forbids formula from a GitHub commit URL: https://github.com/Homebrew/brew/issues/8791 – Yeoman Dec 21 '22 at 13:30