I had tried the instructions in emacs/nt/INSTALL last year for the 32-bit build
but something went wrong (I don't remember what, exactly), so recently I tried
the instructions for
emacsbinw64 - it worked very well, and it was simpler to get the necessary libraries also. It uses MSYS2 and MinGW-w64 for a 64-bit build - the emacsbinw64 project provides binaries at https://sourceforge.net/projects/emacsbinw64/files/.
So I wrote up some instructions following that outline, with feedback from Eli Zaretski and the author Chris Zheng - the full version is up at http://git.savannah.gnu.org/cgit/emacs.git/plain/nt/INSTALL.W64?h=emacs-25 (just includes building from a release tarball also).
This took about 90 minutes total on an Intel i3 and high speed internet connection - YMMV. Note that most of the work for building on Windows is just setting up the build environment...
The total space required is 3GB: 1.8GB for MSYS2 / MinGW-w64 and 1.2GB for
Emacs with the full repository.
Download and install MinGW-w64 and MSYS2
Download the x86_64 version of MSYS2 (i.e. msys2-x86_64-.exe)
Run this file to install MSYS2 in your preferred directory, e.g. the default
C:\msys64 -- this will install MinGW-w64 also. Note that directory names
containing spaces may cause problems.
Then you'll need to add the following directories to your Windows PATH
you can do this through Control Panel / System and Security / System /
Advanced system settings / Environment Variables / Edit path.
Adding these directories to your PATH tells Emacs where to find the DLLs it
needs to run, and some optional commands like grep and find. These commands
will also be available at the Windows console.
Download and install the necessary packages
Run msys2_shell.bat in your MSYS2 directory and you will see a BASH window
In the BASH prompt, use the following command to install the necessary
packages (you can copy and paste it into the shell with Shift + Insert):
pacman -S base-devel \
You now have a complete build environment for Emacs.
Install Git (optional) and disable autocrlf
If you don't already have Git on your system, you can install it
in your MSYS2 environment with:
pacman -S git
The autocrlf feature of Git may interfere with the configure file, so it is
best to disable this feature by running the command:
git config core.autocrlf false
Get the Emacs source code
To download the Git repository, do something like the following -- this will
put the Emacs source into C:\emacs\emacs-25:
git clone git://git.sv.gnu.org/emacs.git emacs-25
Now you're ready to build and install Emacs with autogen, configure, make,
and make install.
First we need to switch to the MinGW-w64 environment. Exit the MSYS2 BASH
console and run mingw64_shell.bat in the C:\msys64 folder, then cd back to
your Emacs source directory, e.g.:
If you are building the development sources, run autogen to generate the
Now you can run configure, which will build the various Makefiles.
The '--prefix' option specifies a location for the resulting binary files,
which 'make install' will use - in this example we set it to C:\emacs\emacs-25.
If a prefix is not specified the files will be put in the standard Unix
directories located in your C:\msys64 directory, but this is not recommended.
Note also that we need to disable Imagemagick because Emacs does not yet
support it on Windows.
./configure --prefix=/c/emacs/emacs-25 --without-imagemagick
This will compile Emacs and build the executables, putting them in the src
To speed up the process, you can try running
where N is the number of cores in your system -- if your MSYS2 make supports
parallel execution it will run significantly faster.
Run make install
Now you can run "make install", which will copy the executable and
other files to the location specified in the configure step. This will
create the bin, libexec, share, and var directories:
You can also say
make install prefix=/c/somewhere
to install them somewhere else.
To test it out, run
and if all went well, you will have a new 64-bit version of Emacs.
Make a shortcut
To make a shortcut to run the new Emacs, right click on the location where you
want to put it, e.g. the Desktop, select New / Shortcut, then select
runemacs.exe in the bin folder of the new Emacs, and give it a name.
You can set any command line options by right clicking on the resulting
shortcut, select Properties, then add any options to the Target command,
Thanks to Chris Zheng for the original build outline as used by the
emacsbinw64 project, located at https://sourceforge.net/p/emacsbinw64/wiki/Build%20guideline%20for%20MSYS2-MinGW-w64%20system/.
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see http://www.gnu.org/licenses/.