Skip to content

macOS build instructions

Lionel Henry edited this page Oct 30, 2018 · 1 revision

Installing as a framework

On macOS, it is easiest to install the development version of R as a full framework in /Library/Frameworks/R.framework/Versions. This way, after a make install, you can switch to the development version with Simon Urbanek's RSwitch.app utility. This might require root privileges at the make install step. You can also chown -R the R.framework folder to your user login. To install an R framework, pass --enable-R-framework to the configure script:

./configure --enable-R-framework

If you'd like to install the development versions in a different framework than the released versions, use the following to append -dev to the framework name (e.g. install to 3.6-dev rather than 3.6):

# Get version in major.minor format:
VERSION=`sed 's/\([0-9]*.[0-9]*\).[0-9]*.*/\1/' VERSION`

# Use version-dev as default folder target:
TARGET=${1:-$VERSION-dev}

./configure --enable-R-framework FW_VERSION=${TARGET}

Build variables

You can change important build variables by passing them to the configure script. The defaults should normally be appropriate:

  • By default, CPPFLAGS and LDFLAGS contain /usr/local/include and /usr/local/lib which is where libraries installed with brew are linked.

  • By default, CC points to gcc which is an alias for the system clang.

Troubleshooting

liblzma library and headers are required

brew install xz

zlib library and headers are required

brew install zlib

configure error: cannot run C compiled programs

xcode-select --install