---
name: "ruby-module"
section: "5"
platform: "openbsd"
package: "man"
version: "8.0-current-20261101"
release: "OpenBSD 8.0-current (2026-11-01)"
platforms: ["openbsd"]
url: "https://new.carta.tech/ruby-module"
---

# ruby-module(5)

lang/ruby port module

## NAME

**ruby-module** – lang/ruby port module

## DESCRIPTION

This manual page documents the behavior of setting MODULES=lang/ruby in the [ports(7)](/ports/7.md) tree.

The main usage of the lang/ruby module is to allow a single Ruby gem-based port to build packages for multiple versions of Ruby. The lang/ruby module also simplifies ports that depend on Ruby by automatically setting up the correct dependencies and defining commonly needed variables.

To allow a single Ruby gem-based port to build packages for multiple versions of Ruby, set a specific CONFIGURE\_STYLE, which modifies some additional parameters:

- CONFIGURE\_STYLE="ruby gem"

  For pure Ruby gems without C extensions. This adds PKG\_ARCH = \* to the port.

- CONFIGURE\_STYLE="ruby gem ext"

  For Ruby gems with C extensions. To pass additional arguments to **gem** **install** when building the port, set those via CONFIGURE\_ARGS.

CONFIGURE\_STYLE="ruby gem" and CONFIGURE\_STYLE="ruby gem ext" both add ruby34 and ruby40 FLAVORs to the port. They also cause the FULLPKGNAME to use the FLAVOR- instead of ruby- as the package prefix.

The ports system defaults to using Ruby 4.0 if the version of Ruby is not specified. To specify a version for a gem port, use a specific FLAVOR, such as ruby34 to use Ruby 3.4. To specify the Ruby version to use for a non Ruby-gem port, set MODRUBY\_REV to 3.4 or 4.0.

To ensure that dependencies use the same Ruby implementation as the current port, all Ruby gem dependencies specified in the port should use this format:

```
category/ruby-foo,${MODRUBY_FLAVOR}
```

To prevent the ports system from automatically setting up FLAVORs in a gem port, set MODRUBY\_HANDLE\_FLAVORS to **No**. Similarly, to let the ports system automatically set up FLAVORs in a non-gem port, set MODRUBY\_HANDLE\_FLAVORS to **Yes**. When MODRUBY\_HANDLE\_FLAVORS is **Yes**, the ports system automatically adds the appropriate prefix to the FULLPKGNAME (e.g. ruby40- for ruby 4.0, ruby34- for ruby 3.4).

For Ruby gem ports that can work on multiple Ruby versions, append GEM\_BIN\_SUFFIX to every binary file entry in the PLIST. This is because the gem binaries for multiple Ruby versions are all installed to *${LOCALBASE}/bin*, and the binaries all use a version-specific suffix. Any man pages and other files that would be installed to locations not specific to a Ruby implementation (such as under *${LOCALBASE}/share*), should use GEM\_MAN\_SUFFIX before the extension so the different FLAVORs do not conflict.

make update-plist may remove GEM\_BIN\_SUFFIX and GEM\_MAN\_SUFFIX from the PLIST, or use them in inappropriate places, so be careful when updating gem ports with binaries or man pages. Additionally, for gem ports with C extensions, make update-plist will add back files used by the specific FLAVOR (such as files under the extension source directory), which may not exist for other FLAVORs, so always manually check the result of make update-plist and manually test that all supported FLAVORs are buildable before committing. Additionally, for gems with C extensions, make update-plist may add back the extension source files, which shouldn't be included in the files, so make sure to double check that all files added by make update-plist should be included in the package.

The lang/ruby module creates a do-test target if MODRUBY\_TEST is used and one is not already defined.

The lang/ruby module appends to the following variables:

- BUILD\_DEPENDS

  Adds dependency on version of Ruby in use unless MODRUBY\_BUILDDEP is set to **No**, or NO\_BUILD is set to **Yes**.

- CATEGORIES

  Adds the lang/ruby category.

- RUN\_DEPENDS

  Adds dependency on version of Ruby in use unless MODRUBY\_RUNDEP is set to **No**.

- TEST\_DEPENDS

  Adds the rspec dependency if MODRUBY\_TEST is set to rspec3.

- SUBST\_VARS

  Adds GEM\_EXTENSIONS\_DIR, MODRUBY\_RELEXAMPLEDIR, MODRUBY\_SITEARCHDIR, MODRUBY\_SITEDIR, MODRUBY\_LIBREV, MODRUBY\_ARCH, GEM\_LIB, GEM\_BIN, and DISTNAME.

- UPDATE\_PLIST\_ARGS

  Adds options so that MODRUBY\_RELEXAMPLEDIR, MODRUBY\_SITEARCHDIR, MODRUBY\_SITEDIR, GEM\_LIB, and GEM\_BIN are only substituted at the start of paths.

If using CONFIGURE\_STYLE="ruby gem" or CONFIGURE\_STYLE="ruby gem ext", it also appends to the following variables:

- EXTRACT\_CASES

  Adds support for extracting .gem files.

If using CONFIGURE\_STYLE="ruby gem ext", it also appends to the following variables:

- WANTLIB

  Adds libraries used by Ruby.

- LIB\_DEPENDS

  Adds MODRUBY\_LIB\_DEPENDS.

- PKG\_ARGS

  Adds additional PLIST so that loading native extensions will not attempt to rebuild them at runtime.

- SUBST\_VARS

  Adds GEM\_EXTENSIONS\_DIR.

If using MODRUBY\_HANDLE\_FLAVORS=Yes, it also appends to the following variables:

- SUBST\_VARS

  Adds GEM\_BIN\_SUFFIX and GEM\_MAN\_SUFFIX to SUBST\_VARS so that the PLISTs work on multiple Ruby versions.

The lang/ruby module sets the following variables:

- GEM

  The path to the appropriate **gem** binary for the current Ruby version (/usr/local/bin/gem${MODRUBY\_BINREV}).

- GEM\_BASE\_BIN

  The absolute path where the **gem** program will install the executable files provided by the gem (if any) during the fake target.

- GEM\_BASE\_LIB

  The absolute path where the **gem** program will install library files provided by the gem during the fake target.

- GEM\_BIN

  The relative path under PREFIX where the package installs the gem's executable files.

- GEM\_BIN\_SUFFIX

  The suffix to use for the gem's executable files, so that separate FLAVORs of the port do not conflict.

- GEM\_EXTENSIONS\_DIR

  The relative path under PREFIX where the package installs Ruby-version specific files for Ruby gems with C extensions.

- GEM\_FLAGS

  Option flags for **gem** **install** when building the port.

- GEM\_LIB

  The relative path under PREFIX where Ruby gem files are stored for the Ruby version in use.

- GEM\_MAN\_SUFFIX

  The suffix to use for the gem's manual pages, so that separate FLAVORs of the port do not conflict.

- MODRUBY\_ADJ\_FILES

  A list of filename patterns that will automatically have MODRUBY\_RUBY\_ADJ called on them during pre-configure.

- MODRUBY\_ARCH

  The platform-specific string used by Ruby for files installed into platform-specific directories.

- MODRUBY\_BINREV

  The same as MODRUBY\_REV except without the dot (‘.’), reflecting the suffix used by the programs for the Ruby version in use.

- MODRUBY\_BIN\_RSPEC

  The path to the rspec (rspec 3) binaries for the Ruby version in use.

- MODRUBY\_BUILD\_DEPENDS

  The same as MODRUBY\_RUN\_DEPENDS. It is designed to be used in BUILD\_DEPENDS values for other ports depending on Ruby.

- MODRUBY\_BUILDDEP

  If Ruby does not need to be installed while building the package(s), set to **No**. The default is **Yes**.

- MODRUBY\_FLAVOR

  The FLAVOR to use for Ruby dependencies to ensure that they use the same version of Ruby as the current port.

- MODRUBY\_HANDLE\_FLAVORS

  Determines whether the port allows building with multiple FLAVORs, with each FLAVOR supporting a separate Ruby version.

- MODRUBY\_LIBREV

  The same as MODRUBY\_REV.

- MODRUBY\_LIB\_DEPENDS

  The same as MODRUBY\_RUN\_DEPENDS. It is designed to be used in LIB\_DEPENDS values for other ports depending on Ruby.

- MODRUBY\_PKG\_PREFIX

  The prefix to use for packages built using the lang/ruby module, if the port support building with multiple Ruby versions.

- MODRUBY\_RELEXAMPLEDIR

  The relative path under PREFIX where the package installs example files for non-Ruby gem ports.

- MODRUBY\_REV

  Includes the major and minor versions of the version of Ruby in use, separated by a dot (‘.’). The port can override the value to specify which Ruby version to use, if the port sets or defaults to MODRUBY\_HANDLE\_FLAVORS=Yes.

- MODRUBY\_RUBY\_ADJ

  A command that takes filename arguments and replaces the */usr/bin/env* ruby shebang lines with RUBY.

- MODRUBY\_RUN\_DEPENDS

  The port path for the Ruby version in use. It is designed to be used in RUN\_DEPENDS values for other ports depending on Ruby.

- MODRUBY\_RUNDEP

  If the packages do not depend on Ruby at runtime, set to **No**. The default is **Yes**.

- MODRUBY\_SITEARCHDIR

  The relative path under PREFIX where the package installs platform-specific library files for non-Ruby gem ports.

- MODRUBY\_SITEDIR

  The relative path under PREFIX where the package installs non-platform-specific library files for non-Ruby gem ports.

- MODRUBY\_TEST

  Set to **ruby**, **rake**, **rspec3**, or **testrb** to choose the appropriate program to run the regress tests, if the port includes tests.

- MODRUBY\_TEST\_ENV

  Sets environment variables for the regress tests.

- MODRUBY\_TEST\_TARGET

  Sets the argument to the regress test program.

- MODRUBY\_WANTLIB

  Includes the library-specs for the Ruby version in use.

- RAKE

  The path to the **rake** program for the Ruby version in use (/usr/local/bin/rake${MODRUBY\_BINREV}).

- RUBY

  The path to the [ruby(1)](/ruby/1.md) program for the Ruby version in use (/usr/local/bin/ruby${MODRUBY\_BINREV}).

## SEE ALSO

[bsd.port.mk(5)](/bsd.port.mk/5.md), [port-modules(5)](/port-modules/5.md)
