FAQ
- What do the RubyInstaller-2.4 install components do?
- 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: What do the RubyInstaller-2.4 install components do?
A: See the corresponding stackoverflow question.
Q: Are there recommendations for working with rails?
A: First of all you should make sure the MSYS2-DevKit is installed and up-to-date by running:
ridk install 1 2 3
Most of the binary gems are updated for Ruby-2.4 now, so that most of the gems should work flawless. If you still get errors kind of LoadError: cannot load such file -- 2.4/<mygem>
, try to update the gem and if this doesn't work, open an issue to update the binary gem.
Alternatively it is often possible to use gem install <mygem> --platform ruby
to force installation of the source gem. For bundler there is only a "one for all" switch, which disables all binary gems and requires to manually install dependent pacman packages. So if you want to build all packages from source use: bundle config force_ruby_platform true
The Javascript, that is used to produce asset files, doesn't work with the default interpreter "JScript" (Microsoft Windows Script Host). However a alternative Javascript interpreter can be used by adding this line to your Gemfile. This will be the default in rails-5.2:
gem "duktape"
The mysql2
gem is not ready for RubyInstaller-2.4. There is a patch to fix this. You can use it so:
git clone https://github.com/larskanis/mysql2.git
cd mysql2
git checkout fix-ri2
gem build mysql2.gemspec
gem install mysql2-0.4.8.gem
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
. [default if started with/silent
or/verysilent
] -
defaultutf8
: Set environment variableRUBYOPT=-Eutf-8
. -
nodefaultutf8
: Don't set theRUBYOPT
environment variable [default].
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.