FAQ
- Are there recommendations for working with rails?
- How do I perform a silent install with the RubyInstaller?
- What is recommended way to update a Ruby installation?
- Can RubyInstaller2 be used without installation (e.g. from a USB stick)?
Q: Are there recommendations for working with rails?
A: Until more binary gems are updated to ruby-2.4, it is often best to use gem install <mygem> --platform ruby
to force installation of the source gem. Otherwise the gem installation often works, but fails later on with a LoadError: cannot load such file -- 2.4/<mygem>
at runtime. For bundler-1.14+ use:
bundle config force_ruby_platform true
For rails with nokogiri and sqlite use:
ridk exec pacman -S mingw-w64-i686-sqlite3 mingw-w64-i686-libxslt # 32 bit Ruby
ridk exec pacman -S mingw-w64-x86_64-sqlite3 mingw-w64-x86_64-libxslt # 64 bit Ruby
bundle config force_ruby_platform true
bundle config build.nokogiri --use-system-libraries
bundle install
The Javascript, that is used to produce asset files, doesn't work with the default interpreter "JScript" (Microsoft Windows Script Host) currently. However a alternative Javascript interpreter can be used by adding this line to your Gemfile:
gem "duktape"
Q: How do I perform a silent install with the RubyInstaller?
A: The RubyInstaller currently uses Inno Setup which allows two levels of silent installation (silent with just an install progress window, or very silent without even an install progress window) to be selected using either the /silent
or /verysilent
command line options.
When performing silent installations, you often want to specify where to install the Ruby environment and which operations should be done. The Inno Setup Help provides the details of the possible command line options. The /tasks
parameter can control additional actions of the installer:
-
modpath
: Update your PATH environment variable to use the newly installed ruby. [default] -
nomodpath
: Don't update the PATH environment variable. -
assocfiles
: Associate .RB/.RBW files to the newly installed ruby. [default] -
noassocfiles
: Don't associate .RB/.RBW files. -
ridkinstall
: Runridk install
for MSYS2 installation subsequent to the installer. [default] -
noridkinstall
: Don't runridk install
.
An example shows how easy it is:
# silent install to custom dir with default options
c:\>rubyinstaller.exe /silent /dir="e:/my_test_ruby"
# very silent install to default dir with file associations but no PATH update
c:\>rubyinstaller.exe /verysilent /tasks=assocfiles,nomodpath
# very silent install to custom dir without file associations, PATH update and ridk install
c:\>rubyinstaller.exe /verysilent /dir="d:/rubyABC" /tasks="noassocfiles,nomodpath,noridkinstall"
Q: What is recommended way to update a Ruby installation?
You can usually update your Ruby installation by installing into the same directory, as long as the major and minor part of the Ruby version keeps the same. If the major and minor part of the Ruby version is different (2.4 vs. 2.5), then ruby needs to be installed into a separate directory and all gems needs to be reinstalled. You can use uru to switch between different ruby versions.
Q: Can RubyInstaller2 be used without installation (e.g. from a USB stick)?
Yes, both Ruby and MSYS2 can be used without installation. It doesn't matter which RubyInstaller2 download variant is being used - both exe and 7z are suitable as base installation for a portable ruby. Obviously no start menu items are generated nor file associations or additions to the PATH on the target system. However ruby programs can be started, simply by running the binstub *.bat
or *.cmd
file in <ruby-path>/bin/
. For instance double click on f:/portable/ruby/bin/irb.cmd
to open a interactive ruby session.
MSYS2 can be used in a portable ruby installation as well. The msys64
or msys32
directory must be placed within the ruby path or alongside to this directory. So both f:/portable/ruby/msys64/
and f:/portable/msys64/
would work. Please note however, that the MSYS2 shell must be started at least once, in order to initialize it's key setup for pacman. And spaces in the path will cause issues when installing gems, so better avoid them.