Take the 2-minute tour ×

There are a ton of ways to integrate Cygwin with Emacs on Windows. EmacsWiki shows a few ideas. Here are the options that I've found:

  1. Use the Emacs that comes with Cygwin. (Then find a way to get to cmd.exe if you want it.)
  2. Use NTEmacs and Cygwin as a "sometimes" shell. (A special command to launch Cygwin)
  3. Use NTEmacs and Cygwin as the "always" shell. (M-x shell launches cygwin)

To give some clarity as to "why". Here are a couple of examples where I wish I had Cygwin with Emacs:

  1. M-x whois doesn't work on NTEmacs.
  2. Packages like Wanderlust include a Makefile that isn't Windows friendly.
  3. Sometimes I just need a bash shell for something.

So which option of Emacs/Cygwin works well for others? Also, has anyone tried MSYS integration successfully?

share|improve this question

10 Answers 10

A fourth choice is to run emacs in one of Cygwin's alternative terminals: (u)rxvt, mintty, xterm. These all offer much better terminal emulation than the console, which means a much improved emacs experience.

share|improve this answer
Are you assuming the Cygwin Emacs here? –  Laurynas Biveinis Jan 16 '10 at 12:03
Yep, I should have mentioned that. NTemacs probably won't work in any of those terminals since presumably it requires the console. –  ak. Jan 16 '10 at 12:14
Interesting idea. Do you notice much of a lag in performance (seeing it's not native like NTEmacs)? Also, how do you launch one of these terminals and which one do you like best? Thanks for the reply. –  User1 Jan 20 '10 at 17:19
I haven't used NTemacs, so couldn't really compare, but Cygwin isn't as non-native as many people think. The program code itself runs natively anyway; it's just the POSIX API calls that need to be mapped to Windows, and in most cases that's a pretty thin mapping layer. fork() is the big exception, but that shouldn't matter in an editor. Regarding the terminal I'd recommend mintty, but I'm biased because I wrote it. –  ak. Jan 21 '10 at 5:15
Are you suggesting running emacs in curses mode (no GTK UI) under a terminal program? BTW I looked into it and mintty is very cool. Did you see this blog post: chadaustin.me/2009/10/… –  User1 Jan 23 '10 at 2:02
up vote 8 down vote accepted

Use the Emacs in Cygwin. Not XEmacs..Emacs. I just install everything from Cygwin and type the following to run Emacs:

XWin -multiwindow
export DISPLAY=:0.0

It may also help to create a link to your C drive (or any other drive) like so:

ln -s /cygdrive/c /c

I've been using this for several months and it always works well. I constantly use advanced features like TRAMP and subversion without any issues. All advanced packages like cedet just work.

If you hadn't noticed, I am the original poster. After all of my research and attempts, this one worked and I am VERY PLEASED. Good job Cygwin!

Also, I recommend not using shell within Emacs. Utilities like top just don't seem to work. Instead, use MinTTY and screen. Cygwin gives you ssh directly in MinTTY (you don't need putty). The best part is that a lot of my Linux knowledge works seamlessly in Windows.

share|improve this answer

I tend to use the native version of emacs on windows in conjunction with the (also native) ports of gnu utils, which are much faster, though less complete, than the Cygwin ones.

Then I just use a cygwin window for the bash shell and the things that are missing.

share|improve this answer

The best solution must be cygwin emacs-w32. It using win32 native gui, and using cygswin POSIX system. That means you have a windows native gui program and all the cygwin path, shell working.

Installation is very easy: setup.exe --> emacs-w32. Now the version number is:

So good.

share|improve this answer
have to accept the fact that I am using it under windows –  zinking Nov 6 '13 at 13:25

I installed cygwin on the root. It explicitly warns you against it, but I saw no ill effects. (I found that piece of advice from Steve Yegge).

I also installed cygwin-mount, which helps a bunch. Also, I had to switch from ispell to aspell. Finally, a little bit of .emacs tweaking, and I was good to go:

(when (equal system-type 'windows-nt) 
(message "Setting up Cygwin...")
(let* ((cygwin-root "c:")
       (cygwin-bin (concat cygwin-root "/bin"))
       (gambit-bin "/usr/local/Gambit-C/4.0b22/bin/")
       (snow-bin "/usr/local/snow/current/bin")
       (mysql-bin "/wamp/bin/mysql/mysql5.0.51a/bin/"))
   (setenv "PATH" (concat cygwin-bin ";" ;
                          snow-bin ";" 
                          gambit-bin ";"
                          mysql-bin ";"
           (getenv "PATH"))
   (setq exec-path (cons cygwin-bin exec-path)))

(require 'cygwin-mount)

(setq shell-file-name "bash")

(defun jonnay-cygwin-shell ()
  "Wrapper around cygwin-shell so that it doesn't throw an error"
  (condition-case e
   (message "There was an error trying to launch the shell: %s" e)))

(message "Setting up Cygwin...Done")

;; found from the manual, check, use and make go?
 (defun my-shell-setup ()
   "For Cygwin bash under Emacs 20"
   (setq comint-completion-addsuffix t)
   (setq comint-eol-on-send t)

(add-hook 'emacs-startup-hook 'jonnay-cygwin-shell)
share|improve this answer

I like the xemacs version that you get from the Cygwin setup program. Works out of the box, the Alt key maps to Meta just fine, and the bash shell buffer is there whenever you need it.

share|improve this answer

The third option. I am using NTEmacs + EmacsW32 + Cygwin. This way I have a native Windows application with Unix utilities and bash shell. The makefiles work, I have never used M-x whois though. I cannot think of any immediate drawbacks of this setup.

Here are interesting bits of my setup, basically very similar to http://www.emacswiki.org/emacs/NTEmacsWithCygwin:

(setq cygwin-root "c:/cygwin/")
(setq private-bin (concat home-dir "/usr/bin"))
(setq exec-path (cons private-bin exec-path))
(setenv "PATH" (concat private-bin ";" (getenv "PATH")))
; Add Cygwin Emacs stuff
(add-to-load-path "/usr/share/emacs/site-lisp")
; Add Cygwin Info pages
             (concat cygwin-root "usr/share/info/"))

(setq shell-file-name "bash")
(setenv "SHELL" shell-file-name)

(setq w32shell-cygwin-bin "c:\\cygwin\\bin")
(require 'w32shell)
(w32shell-set-shell "cygwin")
share|improve this answer

Just like @justinhj, I use the native version of emacs on windows in conjunction with the (also native) ports of gnu utils (e.g. binutils for 'strings', etc.).

And I always use cygwin as the shell, within Emacs or independently of Emacs. That way, I retain the look & feel of my work environment when I switch back & forth from Windows to/from Linux/AIX/Solaris.

Unfortunately however, when I upgraded my Emacs from 21.2 to 23.2, Emacs lost its ability to recognize '/cygwin/c' by default. I have to research this now to see why it isn't working anymore and what I can do to fix that. I just found the following information and I'll check it out to see whether this is helpful. It seems odd that now that I need an external package for something that used to be always there by default:

I prefer, however, to minimize the use of additional packages. So, I just checked further the behavior of my "new" Emacs + Cygwin and it seems that I can access the C: drive by simply typing '/'.

That is cool - only one character (slash) instead of /cygdrive/c. However, the shell within Emacs prompts with '/cygdrive/c', a somewhat confusing difference.

share|improve this answer

I investigated three options, all with windowed (but not X11) versions of Emacs. (The terminal is too hardcore for me.) Here goes:

  1. The XEmacs that comes with Cygwin
  2. EmacsW32
  3. Standard Emacs for Windows

The Cygwin folks want to steer you to their Emacs/XEmacs. In http://cygwin.com/faq/faq-nochunks.html#faq.using.ntemacs, they write "Note that all of this ``just works'' if you use the Cygwin port of Emacs or XEmacs from Cygwin Setup".

Be sure to install the xemacs-sumo package in addition to xemacs; otherwise M-x shell won't work. You can launch xemacs without using X11 as

DISPLAY= xemacs &

Drawbacks: 1) Boy, this is an old Emacs. I didn't really want to soldier on with this when everyone else is using Emacs 23. 2) I found it mildly annoying that the install required a whole bunch of X11 libs even if you aren't running X11. 3) No cua-mode out of the box.

EmacsW32 (http://ourcomments.org/Emacs/EmacsW32.html) has a one-click installer, a M-x cygwin-shell command, and CUA mode. But tab completion in the Cygwin shell uses Windows paths, which drove me crazy. The W32 port doesn't seem to be actively improved since 2008, but they provide installers with more recent Emacs versions.

The standard Emacs for Windows seems to be the best bet. Download from http://ftp.gnu.org/pub/gnu/emacs/windows/, unzip, and launch from inside Cygwin. Then it picks up the home directory etc. Paste the mumbo-jumbo from http://cygwin.com/faq/faq-nochunks.html#faq.using.ntemacs into ~/.emacs. Restart Emacs and run M-x shell. All works as expected.

share|improve this answer
I haven't tried XEmacs with Cygwin, but the Emacs version in Cygwin is currently at 23. –  User1 Nov 24 '10 at 17:12

FWIW, I use the normal GNU Emacs Windows releases, and I use Cygwin. I've never had any problems, but I don't do much with Cygwin outside Emacs. Oh, and I'm using an old version of Cygwin (with all versions of Emacs).

For setup, I load these two files, in order:

share|improve this answer

Your Answer


