asdf-r
March 12, 2026 ยท View on GitHub
R plugin for asdf version manager | plugins repository
Dependencies
MacOS
- Homebrew: used to install the remainder of the dependencies
brew install gcc xz libxt cairo pcre2
More details on environment variables setup for Mac OS builds can be found here.
Linux
Ubuntu / Debian
sudo apt-get install build-essential libcurl3-dev libreadline-dev gfortransudo apt-get install liblzma-dev liblzma5 libbz2-1.0 libbz2-devsudo apt-get install xorg-dev libbz2-dev liblzma-dev libpcre2-dev
Install
asdf plugin add r https://github.com/asdf-community/asdf-r.git
ASDF options
Check asdf readme for instructions on how to install & manage versions of R.
When installing R using asdf install, you can pass custom configure options with the following env vars:
R_CONFIGURE_OPTIONS- use only your configure optionsR_EXTRA_CONFIGURE_OPTIONS- append these configure options along with ones that this plugin already uses
Building R Shared Library
RStudio (and some other libs) requires building R shared library. In order to do that pass an extra configure option to asdf install:
R_EXTRA_CONFIGURE_OPTIONS=--enable-R-shlib asdf install r <version>
maybe you'll need Cairo as well:
R_EXTRA_CONFIGURE_OPTIONS='--enable-R-shlib --with-cairo' asdf install r <version>
Troubleshooting
X11 / XQuartz errors
If you encounter X11-related errors during installation and don't need X11 support, you can skip it:
R_EXTRA_CONFIGURE_OPTIONS='--with-x=no' asdf install r <version>
If you do need X11 support, install XQuartz first manually or by running:
brew install xquartz
Missing library errors (liblzma, pcre2, etc.)
If installation fails with errors about missing libraries like liblzma or pcre2, set the compiler flags to point to the Homebrew installation paths:
export CPPFLAGS="-I$(brew --prefix xz)/include -I$(brew --prefix pcre2)/include"
# or if that doesn't work
export CPPFLAGS="-I/opt/homebrew/include" LDFLAGS="-L/opt/homebrew/lib"
asdf install r <version>
This tells the compiler where to find the required header files for these libraries.