Statistical scripts on a Mac need an R runtime that the shell can find consistently. Homebrew provides the current stable R formula as a bottled package on supported macOS releases, keeping installation and later upgrades under the same package manager.
The Homebrew formula installs command-line R and its runtime dependencies, but it does not install CRAN's R.app desktop console. Use the formula for Terminal sessions, scripts, Quarto, or applications that call the R executable; use the CRAN installer instead when R.app is required.
Formula installations stay inside the Homebrew prefix and do not require sudo for this operation. The formula version recorded by Homebrew confirms package ownership, while a noninteractive expression proves that the installed interpreter can start and evaluate R code.
Related: Install an R package from CRAN
Steps to install R on macOS:
- Open Terminal.
- Install the stable R formula from Homebrew.
$ brew install r
The formula installs the command-line interpreter and its dependencies; it does not include R.app.
- Confirm that Homebrew records an installed R formula version.
$ brew list --versions r r 4.6.1
The version number changes when Homebrew publishes a later stable formula.
- Run a noninteractive expression with the installed R interpreter.
$ R --vanilla --slave -e 'print(R.version.string)' [1] "R version 4.6.1 (2026-06-24)"
The version changes when Homebrew publishes a later stable formula. A version string and exit status 0 confirm that R started and evaluated the expression.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.