4

I wish to run Emacs from the latest development version.

I've downloaded the latest Emacs development version from https://savannah.gnu.org/projects/emacs (with git clone -b master git://git.sv.gnu.org/emacs.git), ran autogen.sh as suggested here, then followed the instructions on the screen: after autogen.sh I executed ./autogen.sh git, then ./configure, and finally make (if I run make install instead, I get the same error message as below). All the steps except make seemed to finish successfully.

As for make, it started off well enough, but at some point it stopped with the following error message:

xml.c:23:10: fatal error: 'libxml/tree.h' file not found
#include <libxml/tree.h>
         ^
1 error generated.
make[1]: *** [xml.o] Error 1
make: *** [src] Error 2

My path includes /usr/local/Cellar/libxml2/2.9.4_3/include/libxml2, and this directory in turn contains libxml/tree.h.

How can I fix the problem?


I run macOS Sierra version 10.12.5 .

  • 1
    Install the libxml library (through homebrew)? – Dan Jul 17 '17 at 18:52
  • @Dan: libxml is not available via Homebrew. – Evan Aad Jul 17 '17 at 18:59
  • @Dan: However libxml2 is available through Homebrew. Will it do? – Evan Aad Jul 17 '17 at 19:08
  • FWIW, the sequence is make (to build the executable and everything else) and make install (to install the built executable and the rest). – wasamasa Jul 17 '17 at 19:24
  • 1
    This looks interesting: lists.gnu.org/archive/html/emacs-devel/2015-11/msg01940.html -- I'm not 100% certain it is applicable, but the bottom line of that particular thread is: "you are missing the command line tools for OSX. Try running xcode-select --install from the command line" – lawlist Jul 17 '17 at 21:50
6

The error message described in the question has previously been encountered by other fellow Emacs enthusiasts, and the recommended fix is to install OSX command line tools by running the following from the command line:

xcode-select --install

Here is the link to the Emacs development thread that described the above solution by Daniel Sutton:

http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg01940.html

  • This solution does not work since macOS 10.14 – cjohansson Sep 29 '18 at 14:16
  • You can get the command line tools for 10.14 Mojave from the download site here: developer.apple.com/download/more Then you'll be able to install the headers as below in @carlbolduc's answer. – Emoses Oct 31 '18 at 17:56
19

The accepted answer does not work anymore since libxml2 will be installed inside the XCode directory. The solution is described here:

https://silvae86.github.io/sysadmin/mac/osx/mojave/beta/libxml2/2018/07/05/fixing-missing-headers-for-homebrew-in-mac-osx-mojave.html

In short, Apple provides an installer that can put the librairies inside /usr/include. You can copy this installer to your desktop by doing this: cp /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg ~/Desktop

Once copied, just launch the installer from your Desktop.

  • This also works for the make error in openconnect – jim Mar 16 at 12:31
  • this worked for me on new 10.14.4 – ikel Apr 26 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.