Skip to content
- Install Homebrew as described here.
- Install following packages in Hombrew
- brew install gcc xz pcre2
- curl -O https://cran.r-project.org/src/base/R-4/R-4.2.2.tar.gz
- tar -xzfv R-4.2.2.tar.gz
- cd R-4.2.2
- ./configure –prefix=$HOME/R-standalone –enable-R-shlib –with-lzma –with-pcre2 LDFLAGS=”-L/opt/homebrew/opt/xz/lib -L/opt/homebrew/opt/pcre2/lib” CPPFLAGS=”-I/opt/homebrew/opt/xz/include -I/opt/homebrew/opt/pcre2/include”
- make -j$(sysctl -n hw.ncpu)
- make install
- Edit Rprofile.site file by typing: vi ~/R-4.2.2/lib/R/etc/Rprofile.site
- At the bottom of this file add: .libPaths(file.path(R.home(), “library”))
- Create the local library directory by typing: mkdir -p ~/R-4.2.2/lib/R/library
- Start R: ~/R-4.2.2/bin/R
- Check correct home directory is used by typing: R.home()
- Check only libraries in ~/R-4.2.2 are used by typing: .libPaths()