Brett Klamer

Install Eventmachine in Ruby 2 for Windows

As of Ruby 2.0.0-p353 and DevKit 4.7.2 you cannot install eventmachine (up to at least 1.0.3). This bug has been around since at least March of 2013 as indicated in the following:

Since the Ruby maintainers seem to be ignoring the issue, who knows when it will be fixed. Not knowing much about Ruby, I couldn't get around the problem following just one example. After combining a few things, here are the steps needed to fix the error.

1. Install eventmachine

Install eventmachine using gem install eventmachine. Ignore the errors for now.

2. Edit project.h

Find the file project.h at or around


and use Claudius Coenen's fix at line 97-98 to redefine

typedef int pid_t;


#ifndef _PID_T_
#define _PID_T_
typedef int pid_t;
#endif /* _PID_T_ */
#endif /* OS_WIN32 */

3. Install git

Download git from here and install. Choose the option to add git.exe to the PATH. When it's finished, restart the computer.

4. Install eventmachine (this time for real)

Using Fernando Vieira's answer (which was edited to include the relevant info), run

gem build eventmachine.gemspec

from the folder at or around


Which should have created the file eventmachine-1.0.3.gem. Next, copy that file to a temporary folder, and from that folder run

gem install eventmachine-1.0.3.gem --local

And it's finally installed!