i am trying to install xml2 from CRAN, and it is throwing an error that it cannot find the libxml2 library configuration.
The thing is that pkg-config seems to be set up correctly: $ echo $PKG_CONFIG_PATH :/usr/local/opt/libxml2/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig $ pkg-config --cflags --libs libxml-2.0 -I/usr/local/Cellar/libxml2/2.9.7/include/libxml2 -L/usr/local/Cellar/libxml2/2.9.7/lib -lx Output of install.packages: > install.packages("xml2") --- Please select a CRAN mirror for use in this session --- trying URL 'https://cloud.r-project.org/src/contrib/xml2_1.2.0.tar.gz' Content type 'application/x-gzip' length 251614 bytes (245 KB) ================================================== downloaded 245 KB * installing *source* package ‘xml2’ ... ** package ‘xml2’ successfully unpacked and MD5 sums checked Found pkg-config cflags and libs! Using PKG_CFLAGS=-I/usr/include/libxml2 Using PKG_LIBS=-L/usr/lib -lxml2 -lz -lpthread -licucore -lm ------------------------- ANTICONF ERROR --------------------------- Configuration failed because libxml-2.0 was not found. Try installing: * deb: libxml2-dev (Debian, Ubuntu, etc) * rpm: libxml2-devel (Fedora, CentOS, RHEL) * csw: libxml2_dev (Solaris) If libxml-2.0 is already installed, check that 'pkg-config' is in your PATH and PKG_CONFIG_PATH contains a libxml-2.0.pc file. If pkg-config is unavailable you can set INCLUDE_DIR and LIB_DIR manually via: R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...' -------------------------------------------------------------------- ERROR: configuration failed for package ‘xml2’ Homebrew package info: dekkera:pkgconfig peter$ brew info libxml2 R libxml2: stable 2.9.7 (bottled), HEAD [keg-only] GNOME XML library http://xmlsoft.org /usr/local/Cellar/libxml2/2.9.7 (281 files, 10.4MB) Poured from bottle on 2018-02-16 at 22:42:54 From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/libxml2.rb ==> Options --HEAD Install HEAD version ==> Caveats This formula is keg-only, which means it was not symlinked into /usr/local, because macOS already provides this software and installing another version in parallel can cause all kinds of trouble. If you need to have this software first in your PATH run: echo 'export PATH="/usr/local/opt/libxml2/bin:$PATH"' >> ~/.bash_profile For compilers to find this software you may need to set: LDFLAGS: -L/usr/local/opt/libxml2/lib CPPFLAGS: -I/usr/local/opt/libxml2/include For pkg-config to find this software you may need to set: PKG_CONFIG_PATH: /usr/local/opt/libxml2/lib/pkgconfig If you need Python to find bindings for this keg-only formula, run: echo /usr/local/opt/libxml2/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/libxml2.pth mkdir -p /Users/peter/Library/Python/2.7/lib/python/site-packages echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/peter/Library/Python/2.7/lib/python/site-packages/homebrew.pth R: stable 3.4.3 (bottled) Software environment for statistical computing https://www.r-project.org/ /usr/local/Cellar/R/3.4.0_1 (2,246 files, 59.1MB) Poured from bottle on 2017-05-20 at 17:10:29 /usr/local/Cellar/R/3.4.1_2 (2,114 files, 55.3MB) Poured from bottle on 2017-09-19 at 03:23:33 /usr/local/Cellar/R/3.4.2 (2,111 files, 55.1MB) Poured from bottle on 2017-11-13 at 22:23:36 /usr/local/Cellar/R/3.4.3 (2,110 files, 55.1MB) Poured from bottle on 2017-12-02 at 23:20:16 /usr/local/Cellar/R/3.4.3_1 (3,773 files, 115.4MB) Built from source on 2018-02-08 at 22:01:49 with: --with-x11 --with-cairo --with-java From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/r.rb ==> Dependencies Build: pkg-config ✔ Required: gcc ✔, gettext ✔, jpeg ✔, libpng ✔, pcre ✔, readline ✔, xz ✔ Optional: openblas ✔ ==> Requirements Optional: java ✔ ==> Options --with-java Build with java support --with-openblas Build with openblas support ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.