FAQ

Lars Kanis edited this page Jun 5, 2018 · 35 revisions

FAQs


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. Unfortunately bundler provides an "one for all" switch only, which disables all binary gems and requires to manually install dependent pacman packages. So only 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 the Javascript interpreter duktape can easily be used by adding this line to your Gemfile. This is the default in rails-5.2:

gem "duktape"

Duktape has ES5.1, but only partial ES6 support. If your project requires ES6 you can alternatively use Node.js. You need to run pacman and rails with ridk enable or ridk exec:

ridk exec pacman -S mingw-w64-x86_64-nodejs
ridk exec rails s

The sqlite3 and msgpack gems are not yet ready for RubyInstaller-2.5. However they can be used per git: source in your Gemfile like so:

gem 'sqlite3', git: "https://github.com/sparklemotion/sqlite3-ruby"
gem "msgpack", git: "https://github.com/msgpack/msgpack-ruby"

This automatically installs the mingw-w64-x86_64-sqlite3 pacman package when you run bundler install .

Q: How do I perform a silent/unattended 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 : Run ridk install for MSYS2 installation subsequent to the installer. [default]
  • noridkinstall : Don't run ridk install. [default if started with /silent or /verysilent]
  • defaultutf8 : Set environment variable RUBYOPT=-Eutf-8.
  • nodefaultutf8 : Don't set the RUBYOPT 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"

Ruby+Devkit installs Ruby and MSYS2 with development packages within the destination path. However please note, that the MSYS2 installation must be completed by executing <dest-path>/bin/ridk install 1 after the installer has finished. This for instance properly sets trusted GPG keys up, so that pacman can work.

The /components parameter can control whether MSYS2 Devkit shall be installed for the Ruby+Devkit installer version. The default is /components=ruby,msys2.

Q: Can I automate the Ruby and MSYS2 installation?

A: There are two easy possibilities: Either use Ruby+Devkit installer above or Chocolatey.

The people at Chocolatey.org provide packages for easy unattended installation of both Ruby and MSYS2. You can install the MSYS2 development tools afterwards per ridk install 2 3 as described on the MSYS2 package page. Install directory is c:/tools/RubyXY-x64 and c:/tools/msys64 by default.

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 installer and 7z archive files 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. Alternatively add the ruby bin path to the PATH environment variable like so:

SET PATH=f:/portable/ruby/bin;%PATH%
ruby -v

MSYS2-Devkit can be used in a portable ruby installation as well. You can either use the Ruby+Devkit installer or place the msys64 or msys32 directory within the ruby path or alongside to this directory. Both f:/portable/ruby/msys64/ and f:/portable/msys64/ would work. Spaces in the path will cause issues when installing gems, so its better to avoid them. To enable MSYS2 and MINGW tools in cmd or powershell simply run:

ridk enable

One pitfall of portable installs is, that gem binstubs (like bundle or rails commands) contain an absolute path. See the issue here. A workaround is to replace the file header of <ruby-dir>/bin/<command>.bat by:

@ECHO OFF
@"%~dp0ruby.exe" "%~dpn0" %*

Q: How does RubyInstaller-2.4+ handle SSL certificate authorities?

We bundle a list of certificate authorities to every RubyInstaller release since version 2.4.1-1. It is updated with every new release to the latest CA list distributed by the Mozilla foundation. See the README-SSL for further details. RubyInstaller releases before 2.4 don't bundle any certificates other than the internal certificates of rubygems.