tidyverse / Installation errors

Causes and fixes for tidyverse installation errors

Common errors when installing tidyverse in R, listed by exact message, each with its cause and fix.

Short answer

tidyverse pulls in packages that must be compiled, such as systemfonts, textshaping, ragg, curl and xml2, so on Linux one missing system development library makes the first of them fail and every later package reports non-zero exit status.

Setting up your environment this way avoids most errors on this page.

PracticeWhat happens if you skip it
On Linux, run pak::pkg_sysreqs("tidyverse") first to list the system libraries needed, install them all, then install tidyverse.Each system library you add only gets you one package further, so you go through many rounds of errors.
On Windows and macOS, use the binary packages from CRAN and answer no when asked to compile from source.Compiling from source needs extra build tools and fails far more often.
On macOS, use R from CRAN instead of R built by Homebrew.Homebrew R compiles ragg and other packages from source and can hit compiler errors.
When an install fails, scroll up and start with the first ANTICONF or fatal error in the log.The final non-zero exit status does not tell you which library is actually missing.
On Linux, Posit Package Manager or r2u can install prebuilt binary packages.Every package compiles on your machine, which is slow and exposes more missing libraries.

Troubleshooting by error message

Find your exact error message. Each entry gives the cause, the fix, and what may come up after the fix.

Configuration failed to find the fontconfig freetype2 library. Try installing:

Cause: systemfonts cannot find the fontconfig and freetype development libraries while compiling.

Fix: Run sudo apt install libfontconfig1-dev libfreetype6-dev on Debian or Ubuntu, or install fontconfig-devel and freetype-devel on RHEL or Fedora, then reinstall tidyverse.

What may come next: Once systemfonts builds, textshaping and ragg usually ask next for harfbuzz, fribidi, libpng and other development libraries.

fatal error: ft2build.h: No such file or directory

Cause: The freetype headers or pkg-config are missing, so the compiler cannot find them.

Fix: Install libfreetype6-dev and pkg-config on Debian or Ubuntu; on Manjaro or Arch, install pkgconf.

Configuration failed to find the harfbuzz freetype2 fribidi library. Try installing:

Cause: textshaping needs the HarfBuzz and FriBidi development libraries, which are not installed.

Fix: Run sudo apt install libharfbuzz-dev libfribidi-dev on Debian or Ubuntu, or install harfbuzz-devel and fribidi-devel on RHEL or Fedora.

What may come next: If apt reports libharfbuzz-dev : Depends: libgraphite2-dev but it is not installable, run sudo apt-get update first and install again.

Configuration failed to find one of freetype2 libpng libtiff-4 libjpeg. Try installing:

Cause: The image library development packages ragg needs are incomplete.

Fix: Run sudo apt install libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev on Debian or Ubuntu, or install freetype-devel, libpng-devel, libtiff-devel and libjpeg-devel on RHEL or Fedora.

Configuration failed because libcurl was not found. Try installing:

Cause: The curl package cannot find the libcurl development library, and httr and other packages that need it fail too.

Fix: Install libcurl4-openssl-dev on Debian or Ubuntu, or libcurl-devel on RHEL or Fedora.

What may come next: After libcurl, the openssl package may ask for libssl-dev next.

Configuration failed because libxml-2.0 was not found. Try installing:

Cause: The xml2 package cannot find the libxml2 development library.

Fix: Install libxml2-dev on Debian or Ubuntu, or libxml2-devel on RHEL or Fedora.

/usr/bin/pkg-config: No such file or directory

Cause: pkg-config is missing, so R package configure scripts cannot look up system libraries and report them missing even when installed.

Fix: Install pkg-config on Debian or Ubuntu, or pkgconf on Manjaro or Arch, then install again.

error: invalid conversion from 'unsigned char*' to 'char*' [-fpermissive] (then ERROR: compilation failed for package 'ragg')

Cause: Homebrew R compiles ragg from source against Homebrew system libraries whose versions do not match.

Fix: Switch to R from CRAN (for example brew install --cask r) and install tidyverse again; it then downloads prebuilt binaries.

What may come next: After switching R, every package installed under Homebrew R must be reinstalled.

ERROR: dependency 'systemfonts' is not available for package 'textshaping'

Cause: This is a follow-on error: systemfonts failed first, so textshaping, ragg and tidyverse cannot install.

Fix: Scroll up to the first systemfonts error, install the system library from the matching entry on this page, and install again.

Scientify is a cloud computer with research software installed and AI agents such as Codex and Claude Code built in. Describe what you need in one sentence, for example "read this survey data, summarize it by grade and gender, and draw grouped box plots with ggplot2", and the agent uses the preinstalled tidyverse to do the data processing and plotting, with no software to install and no code to write.

Compared with installing more on your own computer, the cloud computer already has R 4.4.3 and tidyverse 2.0.0, with the system libraries systemfonts, textshaping and ragg need already in place, so there are no missing libraries to chase, and runs continue after you close your laptop.

The cloud computer comes with more computing power: CPU and GPU clusters can be called on demand for large-scale scientific computing. Compute is billed by the minutes you actually use, so nothing is wasted.

Cloud computer
4 vCPU · 8 GB
Top configuration, for data processing and small to medium jobs
Callable GPU
96 GB VRAM
Up to an RTX PRO 6000 per GPU; H800 80 GB and up to 8 × A10G also available
Callable CPU
224 cores · 3 TB
Largest spec, for large parallel computations

References

Frequently asked questions

Does tidyverse need system libraries on Windows?

No. CRAN provides prebuilt binaries for Windows; answer no when asked whether to compile from source.

Which system libraries does tidyverse need on Ubuntu?

Commonly libfontconfig1-dev, libfreetype6-dev, libharfbuzz-dev, libfribidi-dev, libpng-dev, libtiff5-dev, libjpeg-dev, libcurl4-openssl-dev, libssl-dev and libxml2-dev. pak::pkg_sysreqs("tidyverse") prints the exact command.

The log shows a dozen non-zero exit status lines. Do I fix each one?

No. Most are follow-on errors. Find the first package that failed, install the system library it needs, and the rest usually install with it.

Analyze data in R with Scientify without setup

Upload your data, describe the computation, and Scientify runs it on a cloud computer that is already set up. New accounts get a free cloud computer and US$5 in credit.