Luis Lavena edited this page Sep 27, 2014 · 1 revision

Having a problem when installing or using RubyInstaller? Life is full of glitches and details, we all know that.

Here you'll find a list of the common issues some users have experienced and some guidance to help solve them. Please feel free to add your own experiences and resolutions!

For further help, refer to the RubyInstaller mailing list


Not recognized as an internal or external command, operable program or batch file

By default, RubyInstaller will not alter the PATH used by the system to find applications/executables. This is done to avoid messing with your installation.

If you want this particular version of Ruby be available everywhere, you will need to select the correct option during installation:

RubyInstaller Options

Note: Please remember this option will only affect new Command Prompt windows and not existing ones. Close any window you have open first.

When compiling gems, it complained about missing ruby.h file

We discovered that under some scenarios, users that previously had Cygwin installed in the system are affected during installation of gems that require compilation.

Please check that no leftover of your cygwin install remains in your home directory, specially any .bash_profile or .bashrc file.

You can read more about this issue on this thread

Can't install gems due Errno::EEXIST errors under Windows 7

There has been reports of users unable to install any gem unless UAC is disabled or the command prompt is executed as Administrator.

Users facing this issue are Windows 7 Ultimate (32bits) that in the majority upgraded from previous Release Candidate to RTM versions.

Microsoft's KB970789 might provide some details (under the manual section) to fix the issue.

Another alternative, while radical, is format the NTFS harddrive where Ruby is installed.

This is not a Ruby or RubyInstaller issue but instead one from incorrect filesystem permissions.

Another source of this issue could be the installation of either Cygwin or E-Text Editor, as described here and better findings here

Looks like @VirtualStore@ folder looses the proper permissions and is locking out any 32bits application running on Windows x64 bits due the automatic file redirection.

After upgrading to Windows 8 Customer Preview, the DevKit doesn't work anymore.

Just re-run the DevKit installation, using the --force switch if necessary to restore DevKit functionality.

For some strange reason, it fails to install gems.

There might be lot of reasons why it could fail. Either the gem require compilation, which means the installation of Development Kit, the gem is not compatible with the platform (see Gem List for compatibility) or there is another unknown error.

When installing a gem, if it fail, please take a closer look to the output of gem env command:

RubyGems Environment:
  - RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32]
  - INSTALLATION DIRECTORY: C:/Ruby187/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: C:/Ruby187/bin/ruby.exe
    - ruby
    - x86-mingw32
     - C:/Ruby187/lib/ruby/gems/1.8
     - C:/Users/Luis/.gem/ruby/1.8
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => [""]
     - "install" => "--no-ri --no-rdoc --env-shebang"
     - "update" => "--no-ri --no-rdoc --env-shebang"

Specially, pay attention to INSTALLATION DIRECTORY and GEM PATH

If you notice those directories contain spaces, it might be because you installed Ruby in a folder with spaces (highly not recommended) or because another environment variable in your system is interfering. Directories with spaces often cause problems for the DevKit's GCC compiler.

For example, when trying to smoke test the DevKit install by trying to install the rdiscount gem, investigation of the mkmf.log file shows that GCC can't find files required to build if Ruby is installed to a directory containing spaces (C:\bad ruby192 in this example):

# file: C:\bad ruby192\lib\ruby\gems\1.9.1\gems\rdiscount-1.6.8\ext\mkmf.log

"gcc -o conftest -IC:/bad ruby192/include/ruby-1.9.1/i386-mingw32 -I"C:/bad ruby192/include/ruby-1.9.1"/ruby/backward
-I"C:/bad ruby192/include/ruby-1.9.1" -I.     -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith
-Wwrite-strings -Wno-missing-field-initializers -Wno-long-long conftest.c  -L. -LC:/bad ruby192/lib -L.
-lmsvcrt-ruby191-static  -lshell32 -lws2_32  "

gcc: error: ruby192/include/ruby-1.9.1/i386-mingw32: No such file or directory
gcc: error: ruby192/lib: No such file or directory

checked program was:
/* begin */
1: #include "ruby.h"
3: #include <winsock2.h>
4: #include <windows.h>
5: int main() {return 0;}
/* end */

Also check that HOME variable is actually pointing to your home folder. Use GEM_HOME and GEM_PATH to alter where RubyGems install gems, read their docs here

See another example of this issue here

Mix and matching of RubyInstaller with Cygwin will fail.

To be able to install and compile certain RubyGems with RubyInstaller, you need to have the Development Kit installed. While the DevKit is based on MinGW and MSYS, it is not recommended use a different version than the one provided by RubyInstaller Team.

Do not confuse MSYS with Cygwin. While Cygwin contains GCC, make and other tools also available in the Development Kit, is not the same and having it in the @PATH@ will interfere with the correct behavior of RubyInstaller.

At all times avoid having cygwin in your PATH when working with RubyInstaller and the Development Kit.

All installed fine but can't compile gems under Vista

Under certain versions of Windows Vista, you might find unable to compile gems even after correct installation of RubyInstaller and the DevKit.

If you receive this message:

C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed
to generate an executable file. (RuntimeError)
You have to install development tools first.

And you dig into mkmf.log (found inside the gem directory) you will see something like this:

"gcc -o conftest -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby192/include/ruby-1.9.1/ruby/backward
-IC:/Ruby192/include/ruby-1.9.1 -I.     -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith
-Wwrite-strings -Wno-missing-field-initializers -Wno-long-long conftest.c  -L. -LC:/Ruby192/lib -L.
-lmsvcrt-ruby191-static  -lshell32 -lws2_32  "
gcc: CreateProcess: No such file or directory

Which indicates an error of GCC to invoke one of it's internal processes. A simple workaround to this issue will be add an special directory to the PATH, like this:

C:\>SET PATH=%PATH%;C:\DevKit\mingw\libexec\gcc\mingw32\4.5.1

Please adjust C:\DevKit accordingly to your DevKit installation directory and 4.5.1 to the version of the DevKit you installed (e.g. 3.4.5, 4.5.1).

This is a known bug of GCC on Windows Vista and a request for better message already existfor MinGW project.

You can find all the details of this issue on our group here.

ERROR: Failed to build gem native extension

You've installed both RubyInstaller and DevKit following Development-Kit but during gem installation, you receive a message like this:

C:\devkit>gem install rdiscount --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing rdiscount:
       ERROR: Failed to build gem native extension.

C:/ruby/bin/ruby.exe extconf.rb
C:/ruby/bin/ruby.exe: No such file or directory -- extconf.rb

Or sometimes just this:

ERROR:  Error installing rdiscount:
ERROR: Failed to build gem native extension.

C:/Ruby187/bin/ruby.exe extconf.rb

This has been reported to our group here and here.

After a long back and forth investigation, we found two possible causes for this issue: COMSPEC environment variable (scenario A) and AutoRun registry setting (scenario B), both described below:

Scenario A

Using a command prompt, invoke the following command:


The default output of that should look like:


If in the output includes something different than cmd.exe as executable, then please adjust it to use cmd.exe. Please note that the variable must contain a full path to the cmd.exe executable and relative paths will fail.

Some tools might change your command processor command, which interferes with Ruby invoking child processes.

The non-processed variable (that you will find inside System Properties - Environment variables) is: %SystemRoot%\system32\cmd.exe

Change that and try to install the gem again.

Scenario B

If the problem persist, invoke the following commands in the same command prompt:

REG QUERY "HKCU\Software\Microsoft\Command Processor" /s
REG QUERY "HKLM\Software\Microsoft\Command Processor" /s
REG QUERY "HKCU\Software\Wow6432Node\Microsoft\Command Processor" /s
REG QUERY "HKLM\Software\Wow6432Node\Microsoft\Command Processor" /s

Execute each line individually. Once you run it, will see something like this:

HKEY_CURRENT_USER\Software\Microsoft\Command Processor
CompletionChar        REG_DWORD    0x9
DefaultColor          REG_DWORD    0x0
EnableExtensions      REG_DWORD    0x1
PathCompletionChar    REG_DWORD    0x9

The columns of information are Key, Type and Value. If you see a key named AutoRun, there is a chance this is the culprit of the error you're receiving.

AutoRun interferes with Ruby messing with child process executing and by result, affecting gem installation. Please remove it with the following command:

REG DELETE "HKCU\Software\Microsoft\Command Processor" /v AutoRun

Once you're done, try opening a new command prompt and executing gem installation again.

Executing gem or Ruby generates random segfaults

Under certain versions of Windows, specially on Server editions, you might encounter that Ruby generates random segfaults attempting to use extensions like zlib or openssl, which are normal when using RubyGems.

Symptom: invoking gem install will produce something like the following:

C:\Users\sysadmin>gem install mysql
C:/Ruby186/lib/ruby/1.8/i386-mingw32/ [BUG] Segmentation fault
ruby 1.8.6 (2010-02-04) [i386-mingw32]

If that is the case, DEP(Data Execution Prevention) might be interfering with Ruby extension loading mechanism. DEP is on by default in the Server editions of Windows.

This is covered by KB875352 which provides you details on different modes of execution.

At this time, Ruby executable needs to be added to DEP exclusion list for it to work properly. Please see your Operating System documentation (or the above Knowledge Base article).

%1 is not a valid Win32 application

An attempt to bundle install an application can throw an error like the following:

C:/Dev/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': 193: %1 is not a valid Win32 application.   - C:/Dev/Ruby193/lib/ruby/1.9.1/i386-mingw32/digest/ (LoadError)
        from C:/Dev/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from C:/Dev/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/definition.rb:1:in `<top (required)>'
        from C:/Dev/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler.rb:138:in `definition'
        from C:/Dev/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/cli.rb:219:in `install'
        from C:/Dev/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/vendor/thor/task.rb:22:in `run'
        from C:/Dev/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
        from C:/Dev/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/vendor/thor.rb:263:in `dispatch'
        from C:/Dev/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/vendor/thor/base.rb:386:in `start'
        from C:/Dev/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/bin/bundle:13:in `<top (required)>'
        from C:/Dev/Ruby193/bin/bundle:19:in `load'
        from C:/Dev/Ruby193/bin/bundle:19:in `<main>'

Which seems to be synthesized as:

require "bundler"
require "digest/sha1"
puts Digest::SHA1.hexdigest('Test')

After investigation, having tools that alter loading DLLs (like FRAPS or Detours) can affect loading Ruby's extensions.

It is recommended you disable/uninstall FRAPS.

This has been reported as Issue #102

Cannot install mysql or mysql2 gem with my system MySQL

This issue normally happens under 64bits editions of Windows with 64bits installations of MySQL server (5.0, 5.1 or 5.5)

RubyInstaller, at this time is provided only in 32bits, meaning that it cannot link or use 64bits libraries like libmysql.dll present in a 64bits installation of MySQL.

To workaround this issue, you need to download a 32bits version of these libraries and use them during gem installation:

gem install mysql --platform=ruby -- --with-mysql-include=X:\include --with-mysql-lib=X:\lib\opt

Where X:\ needs to be replaced with a path without spaces where the 32bits version of MySQL was extracted. --platform=ruby will force the compilation and avoid the installation of the binary version of the gem. Remember to uninstall any previous version using gem uninstall mysql --all before.

If you can't find a 32bits version of MySQL, I recommend you download MySQL Connector/C, which is an independent version of libmysql.dll that do not tie you to a version specific MySQL API.

Once compiled and installed, copy libmysql.dll from lib into your Ruby's bin directory.

You can find a complete walk-through of both MySQL Server installation and the gem installation on this post

Gem commands fails if HOME maps to a network drive


  • Windows 7
  • Users home directory is set to a mapped network drive (e.g. H: is mapped to a network drive, environment variable HOMEDRIVE=H:)
  • The network drive is not currently accessible (such as only being accessible on a company network)
  • Fresh install of RailsInstaller 2.0.0


Upon creating an application rails new MYAPP, the last step bundle install fails with the following error message:

C:/Ruby/.../rubygems/spec_fetcher.rb:54:in `stat': No such file or directory - H:/ (Errno::ENOENT)
  from C:/Ruby/.../rubygems/spec_fetcher.rb:54:in `initialize'

Or when doing simple gem install GEMNAME with the following message:

ERROR:  While executing gem ... (Errno::EINVAL)
    Invalid argument - H:/</pre>


If HOME environment variable is not set, Ruby tries to use a combination of HOMEDRIVE and HOMEPATH (e.g. the unaccessible network drive) and fails.


On the command line, execute SET HOME=%USERPROFILE%, which will tell Ruby to use your user profile directory (C:\Users\xyz) as the home directory.

DLL conflicts with DevKit cause native gem install failures

Native gem installations may fail due to a system's existing DLLs conflicting with the DevKit's integrated DLLs. For example, after installing the DevKit you may try to natively compile the @rdiscount@ gem as described in the DevKit tutorial and see an error similar to the following:

C:\Users\user>gem install rdiscount --platform=ruby
Building native extensions.  This could take a while...
ERROR:  Error installing rdiscount:
        ERROR: Failed to build gem native extension.

        C:/Ruby192/bin/ruby.exe extconf.rb
checking for random()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.
C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:435:in `try_link0'
        from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:440:in `try_link'
        from C:/Ruby192/lib/ruby/1.9.1/mkmf.rb:552:in `try_func'

If you attempt to install rdiscount from the Command Prompt (as opposed to PowerShell) you may also see this error directly before the previously mentioned gem installation failure:

as.exe - Entry Point Not Found

The procedure entry point libiconv_set_relocation_prefix could not be
located in the dynamic link library libiconv-2.dll

This failure is due to the native gem compile/install process using a version of libiconv-2.dll other than the one integrated into the DevKit due to how Windows searches for DLLs. More information on the order in which Windows chooses DLLs.

This can be worked around by searching your computer for the file libiconv-2.dll and renaming, deleting, or otherwise moving any found instances out of the way and re-running the native gem install process. At least one user has reported finding a duplicate libiconv-2.dll DLL in the C:\Windows\SysWOW64 directory when attempting to install rdiscount on Windows 7 64bit.

It is recommended that if you don't know why or what put the libiconv-2.dll file in the directory in which you found it, that you move it back after you compile whatever gems you need. This will possibly prevent other applications from breaking.

conftest.c:1:0: internal compiler error: Illegal instruction

Ruby 2.0.0 and newer requires a newer DevKit (as described in the downloads page).

This DevKit has been prepared for processors capable of newer set of instructions (called Nocona found since Pentium 4 processors)

This could be your case if you encounter output similar to the following when inspecting gem installation failures:

conftest.c:1:0: internal compiler error: Illegal instruction
Please submit a full bug report, with preprocessed source if appropriate.
See <> for instructions.

If your computer is older than the minimum requirement, you will need to build your own version of DevKit (following these instructions) and Ruby to match the support on your system.

References: headius/ruby-atomic#36 and RubyInstaller thread

./configure errors on Windows 7

On Windows 7, running ./configure in the MinGW terminal gave several of the following errors:

checking size of uint32_t... rm: cannot lstat `conftest.exe': Permission denied


This is caused by background locking/activity on the files being created. ./configure phase generates a lot of conftest.exe files and quickly removes it.


Option A

This issue happens when Application Experience Service is disabled on a Windows 7 installation.

See this page for further details.

It is recommended you enable Application Experience Service.

Option B

If you have a slow or aggressive antivirus software running, disable your antivirus software and use rake ruby19 from a plain cmd.exe.

Option C

Place all temporary files on RAMdisk, thus avoiding locking issues of spinning disks.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.