Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install specific version of R via homebrew

Tags:

macos

homebrew

r

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 [email protected]

This is what I get:

Error: No available formula with the name "[email protected]" 
==> 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 : )

like image 312
luca tucciarone Avatar asked Nov 15 '22 21:11

luca tucciarone


1 Answers

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.

like image 60
ismirsehregal Avatar answered Jan 19 '23 00:01

ismirsehregal