This is how I install emacs 31 on Windows 11, to get native compilation support, requiring MSYS2 to remain installed.
winget install msys2.msys2 "profiles":
{
"list":
[
{
"commandline": "C:/msys64/msys2_shell.cmd -defterm -here -no-start -mingw64",
"guid": "{05becdfa-31e7-4900-ae5d-818333d164f6}",
"hidden": false,
"icon": "C:/msys64/mingw64.ico",
"name": "MINGW64 / MSYS2",
"startingDirectory": "%USERPROFILE%"
},
]
}In a new mingw64 session
pacman -SuyIf asked, agree to update. Then close session, and re-open.
pacman -Supacman -S --needed \
base-devel \
autoconf \
git \
mingw-w64-x86_64-toolchain \
mingw-w64-x86_64-xpm-nox \
mingw-w64-x86_64-gmp \
mingw-w64-x86_64-gnutls \
mingw-w64-x86_64-libtiff \
mingw-w64-x86_64-giflib \
mingw-w64-x86_64-libpng \
mingw-w64-x86_64-libjpeg-turbo \
mingw-w64-x86_64-librsvg \
mingw-w64-x86_64-libwebp \
mingw-w64-x86_64-lcms2 \
mingw-w64-x86_64-libxml2 \
mingw-w64-x86_64-zlib \
mingw-w64-x86_64-harfbuzz \
mingw-w64-x86_64-libgccjit \
mingw-w64-x86_64-sqlite3 \
mingw-w64-x86_64-libtree-sitterUse github, it's a lot faster than Savanah.
git config core.autocrlf false
cd Repos
git clone https://github.com/emacs-mirror/emacs
cd emacs
git checkout emacs-31./autogen.sh./configure
--without-dbus \
--without-gconf \
--without-gsettings \
--without-pop \
--without-compress-install \
--with-gnutls \
--with-modules \
--with-wide-int \
--prefix=/c/emacs/emacs-31Change 12 to no more than 3/4 of your available CPU cores.
make -j 12 bootstrap
make installTry
make clean, make extraclean, and git clean -fdx. Then repeat previous step.
- Add
C:\msys64\mingw64\bin\toPATHso the msys2 DLLs are available to the binaries. - Set
HOMEtoC:\Users\Luke
- To
"C:\emacs\emacs-31\bin\runemacs.exe --daemoncalledEmacs 31 DaemonatC:\Users\luke\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Start-up. SetStart in:value to your home folder i.e.C:\Users\luke\ - To
"C:\emacs\emacs-31\bin\emacsclientw.exe"calledEmacs 31 ClientatC:\Users\luke\AppData\Roaming\Microsoft\Windows\Start Menu\Programs. Set the target toC:\emacs\emacs-31\bin\emacsclientw.exe -n -c -a "C:\emacs\emacs-31\bin\runemacs.exe" - To
"C:\emacs\emacs-31\bin\emacsclientw.exe"calledEmacs 31atC:\Users\luke\AppData\Roaming\Microsoft\Windows\Start Menu\Programs.
I'm using minimal-emacs
cd ~
git clone --depth 1 https://github.com/jamescherti/minimal-emacs.d .emacs.d
cd .emacs.dIn powershell or pwsh:
cd ~/.emacs.d/
New-Item -ItemType SymbolicLink -Path pre-early-init.el -Target C:\Users\Luke\Repos\dotfiles\pre-early-init.el
New-Item -ItemType SymbolicLink -Path post-early-init.el -Target C:\Users\Luke\Repos\dotfiles\post-early-init.el
New-Item -ItemType SymbolicLink -Path pre-init.el -Target C:\Users\Luke\Repos\dotfiles\pre-init.el
New-Item -ItemType SymbolicLink -Path post-init.el -Target C:\Users\Luke\Repos\dotfiles\post-init.elUse the shortcut to start emacs, so that open file/folder dialogs start at ~
(native-comp-available-p)Should evaluate to t.
To run diff operations in Windows emacs, install diffutils inside of mingw64
pacman -S mingw-w64-x86_64-diffutilspacman -S zip unzipAdd C:\msys64\usr\bin to PATH so zip and unzip are available to Windows.