Anaconda software prevents xml2 package installation: the solution
When trying install xml2 package in terminal, I had an error. The error was caused by anaconda3 software that made a wrong link to the libxml2 library. The solution I found has been to remove anaconda3 install: conda install anaconda-clean anaconda-clean --yes sudo rm -rf /anaconda3 Also, the anaconda-clean --yes command creates a backup in your home directory of the format ~/.anaconda_backup/<timestamp>. Make sure to delete that one also. Then install libxml2 using home-brew : brew install libxml2 and in R install.packages("xml2") You will see something like that: Found pkg-config cflags and libs! Using PKG_CFLAGS=-I/opt/local/include/libxml2 Using PKG_LIBS=-L/opt/local/lib -lxml2 -L/opt/local/lib -lz -L/opt/local/lib -llzma -lpthread -liconv -lm