81: How do I install Emacs?
This answer is meant for users of Unix and Unix-like systems. Users of
other operating systems should see the series of questions beginning with
question 91, which describe where to get non-Unix source and binaries.
These packages should come with installation instructions.
For Unix and Unix-like systems, the easiest way is often to compile it
from scratch. You will need:
* Emacs sources. See question 89 for a list of ftp sites that make them
available. On prep.ai.mit.edu, the main GNU distribution site, sources
are available at
ftp://prep.ai.mit.edu/pub/gnu/emacs-19.28.tar.gz
The above will obviously change as new versions of Emacs come out. For
instance, when Emacs 19.29 is released, it will most probably be
available at
ftp://prep.ai.mit.edu/pub/gnu/emacs-19.29.tar.gz
Again, you should use one of the mirror sites in question 89 (and
adjust the URL accordingly) so as to reduce load on prep.
* Gzip, the GNU compression utility. You can get gzip via anonymous ftp
at prep and its mirror sites; it should compile and install without
much trouble on most systems. Once you have retrieved the Emacs
sources, you will probably be able to uncompress them with the command
gunzip --verbose emacs-19.28.tar.gz
changing the Emacs version (19.28), as necessary. Once gunzip has
finished doing its job, a file by the name of "emacs-19.28.tar" should
be in your build directory.
* Tar, the "tape archiving" program, which moves multiple files into and
out of archive files, or "tarfiles." All of the files comprising the
Emacs source come in a single tarfile, and must be extracted using tar
before you can build Emacs. Typically, the extraction command would
look like
tar -xvvf emacs-19.28.tar
The `x' indicates that we want to extract files from this tarfile, the
two `v's force verbose output, and the `f' tells tar to use a disk
file, rather than one on tape.
If you're using GNU tar (available at prep and its mirrors), you can
combine this step and the previous one by using the command
tar -zxvvf emacs-19.28.tar.gz
The additional `z' at the beginning of the options list tells GNU tar
to uncompress the file with gunzip before extracting the tarfile's
components.
At this point, the Emacs sources (all 25+ megabytes of them) should be
sitting in a directory called "emacs-19.28". On most common Unix and
Unix-like systems, you should be able to compile Emacs (with X Windows
support) with the following commands:
cd emacs-19.28 [ change directory to emacs-19.28 ]
./configure [ configure Emacs for your particular system ]
make [ use Makefile to build components, then Emacs ]
If the "make" completes successfully, the odds are fairly good that the
build has gone well. (See question 83 if you weren't successful.)
To install Emacs in its default directories of /usr/local/bin (binaries),
/usr/local/lib/emacs/19.xx (Lisp code and support files), and
/usr/local/info (Info documentation), become the super-user and type
make install
Note that "make install" will overwrite /usr/local/bin/emacs and any
Emacs Info files that might be in /usr/local/info.
Much more verbose instructions (with many more hints and suggestions)
come with the Emacs sources, in the file "INSTALL".