How to get Emacs on MINGW64 (Windows 10)

431 Views Asked by At

I currently use MINGW64 (Git Bash) as my terminal on my Windows 10 machine. It works great, I like it, but it only has Vim installed as an editor and I prefer Emacs. I'm unfortunately having a really awful time getting it to work in my terminal.

What's weirder still is that I have Emacs working in Cygwin64; but I don't like using that as my terminal. The most logical fix is simply that it Emacs to my Path ENV, however that doesn't seem to help (perhaps I'm doing that wrong?). I just get bash: emacs: command not found. I found a command to install it, using Pacman, however the Pacman command cannot be found either (which is weird because I thought that was installed by default with MINGW64.

Would love any and all help on this.

2

There are 2 best solutions below

0
Chris McMahan On

A couple of options:

  1. Use Cygwin and the Cygwin emacs. Consider your Cygwin environment completely separate from Windows, so set your PATH from within the .bashrc, not within Windows. Launch emacs from the bash command-line.
  2. Use the Emacs Windows binary distribution, but point to the utilities within Cygwin (there's an emacs package to help with this). Again, launch from the bash command line to inherit the bash environment within emacs.
  3. Use the Windows Subsystem for Linux, with a Linux installation, and stick with emacs from there. You get the best of the Linux world, and access to the Windows directories and files as well.

My goto choice for MANY years was the Emacs Windows binary in conjunction with Cygwin. Once I started using the WSL, however, it just worked a lot better, in a clean Linux environment, and I could get terminal and GUI emacs (and other apps) running using the VcXsrv X Server. WSL has a version that directly supports X Windows, but I don't care for the windowing environment it uses, so I stick with VcXsrv.

0
user8128167 On

Not sure why you are having so much trouble with emacs in MINGW64--it works well for me. On a fresh Windows 10 machine here is how I normally setup MSYS2 which includes MINGW64:

$ pacman -Sy
$ pacman --needed -S bash pacman pacman-mirrors msys2-runtime
-Close and reopen msys2 
$ pacman -Su
-Close and reopen msys2 
$ pacman -S base-devel git mercurial cvs wget p7zip
$ pacman -S perl ruby python3 mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain
$ pacman -S --needed base-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain \
                   git subversion mercurial \
                   mingw-w64-i686-cmake mingw-w64-x86_64-cmake

Then, to just install and use emacs, execute this command:

$ pacman -S mingw-w64-x86_64-emacs

If you want to install a lot of optional libraries for emacs, this is the command I normally use:

$ pacman -S mingw-w64-x86_64-emacs mingw-w64-x86_64-qt5 mingw-w64-x86_64-giflib mingw-w64-x86_64-libjpeg-turbo mingw-w64-x86_64-libpng mingw-w64-x86_64-librsvg mingw-w64-x86_64-libtiff mingw-w64-x86_64-imagemagick mingw-w64-x86_64-libxml2  mingw-w64-x86_64-ghostscript mingw-w64-x86_64-graphviz

Here are some of my sources:

https://github.com/orlp/dev-on-windows/wiki/Installing-GCC--&-MSYS2

https://emacs.stackexchange.com/questions/23837/msys2-emacs-install-not-working

HTH