Emacs: How to Build Emacs from git Repository
This page shows you how to compile emacs from developer version of source code on git repository. I assume you are using Ubuntu Linux.
Building Emacs from Git
If you have not build emacs on Linux before, you need to first install built tools and dependent libraries that emacs use. See: How to Build Emacs on Linux. Basically, just run the following first:
# install essential build tools sudo apt-get install build-essential # get all dependencies of a previous emacs version sudo apt-get build-dep emacs23
Now clone emacs from its github mirror.
# clone emacs from github mirror git clone https://github.com/mirrors/emacs.git
It'll create a dir named
emacs in the current dir. 〔➤see git Tutorial〕
if you have build from git before, you might want to clean your repo first.
cd ~/mygit/emacs # discard stuff from last build git reset --hard # delete all of the last build stuff git clean -xdf # get latest update git pull https://github.com/mirrors/emacs.git
cd to the emacs git repo. In the dir, there's a file named
INSTALL.REPO that tells you how to build from repository. But, basically, you just run:
# build emacs from git repo cd ~/mygit/emacs ./autogen.sh ./configure make bootstrap make
The whole process will take about 20 minutes.
When done, the emacs binary will be at dir
emacs/src/. You can cd to it and launch by
You can prepend the path to your shell, so next time you just type
setsid emacs to launch. Put the following line:
# prepend emacs path to environment variable PATH PATH=$HOME/git/emacs/src:$PATH # make sure the dir is correct
at bottom of your
After a few months, you can
git pull the emacs git repository to get update, then compile again.