Installing Emacs 24.3 on Mac OSX Snow Leopard (10.8) — ERRORS!

Good morning! I just installed Emacs 24.3 on a fairly clean install of Mac OS 10.8.5, and I came across (and remedied) several errors that someone else might benefit from knowing about. I may be one of those benefiters next time I have to install emacs, so this is not an entirely self-less post. ANNND, I enjoy writing about little tech triumphs that the non-technical could appreciate, so here goes:

Download emacs-24.3.tar.gz from http://mirrors.syringanetworks.net/gnu/emacs/

Sound terrifying? It is. Please note, this is likely the mirror closest to me (Brooklyn, NY), yours may differ. To find a mirror or get to this page, begin here: http://www.gnu.org/software/emacs/#Obtaining.
Once you’ve downloaded the gzipped file, double-click it in your downloads folder. (HA! I love telling people to double-click.) Great job! Next up, open the file called INSTALL (this is a text file that contains instructions — peruse it so you know I’m not lying as I tell you what to do!).

Two-Minute Interlude: OSX TERMINAL FOR THE TERRIFIED

(I moved this to its own post, as it’s a handy reference and should stand alone.) Back to our regularly scheduled program:

Begin Configurin’

Open a terminal window and cd to where you downloaded emacs. (NOTE: ermm… I maybe shoulda moved that emacs junk from my Downloads folder before installing, but I didn’t. Feel free to comment and correct me! Thanks!) For me this was my “Downloads” folder, so I typed “cd Downloads/emacs-24.3”. From there we’re going to run the configure script that comes with emacs. To do so, merely type “./configure”. A whole bunch of text will run down the screen like a waterfall of characters. It’s great. At the end, if you’re me, you’ll get some warnings that are inconvenient. [NOTE: do look at the INSTALL notes, especially if you get ERRORS or weird warnings! They say to peruse the warnings and fix the following: “wrong CPU and operating system names, wrong places for headers or libraries, missing libraries that you know are installed on your system, etc.” Mine were merely missing image support libraries, as I’ll explain below.] If you have minor errors like mine, I think you might be able to ignore these and just run “./configure” again, but that’s not what I did. Instead, I dealt with them:

Dealing with the Inconvenient Warnings about non-existent Image Libraries

As you’ll see in the INSTALL text that I told you to open first, the clever builders of emacs knew I might run into these problems and included a section on “Image Support Libraries”. There they link to the three libraries that I was missing (as listed in the warnings after running “./configure”). I was missing libjpeg, libgif and libtiff, listed in that order. I therefore went to http://www.ijg.org/, http://sourceforge.net/projects/giflib/, and http://www.libtiff.org/ in that order to fetch and install the necessary libraries. These all work the same way as emacs, though some are more explicitly instructioned than others. What you do:

  • Download stuff and double-click to unzip (heh!).
  • Navigate to that folder in your downloads folder (“cd Downloads/jpeg-9”, etc.)
  • Run “./configure”
  • Check for errors and warnings (TBC below)
  • If no errors, run “make”
  • If no errors, run “make install”
  • You should be done

IF YOU RUN INTO ERRORS, AS I DID: start googling. HA. No, it’s true. But if you installed jpeg-9 and giflib-4.2.3, and then hit a snag on tiff-4.0.3 that references an error in the file “/usr/local/include/jmorecfg.h” on line 263, expecting a “}” to end the “{“, like I did, then you’re in luck. See below:

Remedying the error in “/usr/local/include/jmorecfg.h”

It seems the problem here is that JPEG-9 assumes that TRUE & FALSE aren’t defined if there isn’t a boolean type defined, so you need to add more if clauses. Replace the problem line (#263 in my case) from:

typedef enum { FALSE = 0, TRUE = 1 } boolean;

to:

#ifndef TRUE
#ifndef FALSE
typedef enum { FALSE = 0, TRUE = 1 } boolean;
#else
typedef int boolean;
#endif
#else
typedef int boolean;
#endif

Mega thanks to pingemi, whose post I followed here: https://trac.macports.org/ticket/37982. This fixed the problem for me. Then try the configure; make; make install again for tiff. If this works, then:

Image Libraries Installed, time to “MAKE” emacs!

Once you’ve got that stuff ready, run “./configure” again and it should show no warnings. Then run “make” and if no errors again, try “src/emacs -Q”, and it should open ‘src/emacs’. If something opens with a starting window, you win! Now go back to terminal and run “make install”. Once that’s done you can run “make clean” to tighten up the emacs install folder (which you may want to keep around for debugging). You’re done! Great job! Now good luck figuring out how to use it… (I have been directed to Emacs Prelude to get other configuration set up, but I’ve not yet done it, nor have I the faintest idea how to use emacs — heh.)

That’s all for today, folks! Hope you learned SOMETHING. I learned: a little more about running commands in bash and that those little black icons in finder represent bash executable files such as configure; not to be afraid to dig into some source code when there’s an error (I think that’s generally inadvisable, but in this case there were no really terrifying consequences); that I’m WAAAAYYY more confident dicking around in Terminal than I used to be — I now understood what the instructions were saying and wasn’t afraid to type them; a tiny eentsy bit of C code.

Leave a Reply

Your email address will not be published. Required fields are marked *