RVM on OpenBSD 7.8
BLUF: Install RVM from master!
Update from Jan 1, 2026: My changes got merged on RVM master. Meaning, you can just go ahead and follow the install procedure as explained on rvm.io.
$ \curl -sSL https://get.rvm.io | bash
Attention: The changes are not yet available when using stable! doas support
is planned to be released with rvm-1.29.13.
BLUF: Install RVM from my fork on GitHub!
$ doas pkg_add bash curl
$ curl -ssL https://github.com/karheinz/rvm/raw/refs/heads/fix-openbsd-support/binscripts/rvm-installer |
bash -s -- --source github.com/karheinz/rvm --branch fix-openbsd-support --auto-dotfiles
$ bash -l
$ rvm install ruby-3.4.8
See https://github.com/karheinz/rvm/tree/fix-openbsd-support on GitHub.
Manual Install Procedure
In the following, I’ll show you how to install the Ruby interpreter of your choice on OpenBSD 7.8 using RVM. First we need to install some dependencies and download the installer:
$ doas pkg_add bash curl
$ curl -sSL -o rvm_install.sh https://get.rvm.io
RVM doesn’t know about doas yet, so we need to patch the install script:
$ patch -p0 <<EOF
--- rvm_install.sh Tue Dec 30 13:56:53 2025
+++ rvm_install.sh Tue Dec 30 13:59:56 2025
@@ -48,7 +48,12 @@
(OpenBSD)
log "Trying to install GNU version of tar, might require sudo password"
if (( UID ))
- then sudo pkg_add -z gtar-1
+ then
+ if __rvm_which doas &>/dev/null; then
+ doas pkg_add -z gtar-1
+ else
+ sudo pkg_add -z gtar-1
+ fi
else pkg_add -z gtar-1
fi
rvm_tar_command=gtar
EOF
Now we can install RVM:
$ chmod u+x rvm_install.sh
$ ./rvm_install.sh
RVM is a Bash script, so please make sure the RVM environment is set up on
every Bash startup! You can do this by adding these lines to your .bashrc:
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
# Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
To ensure that .bashrc gets loaded under all circumstances, add this line to your .profile:
[[ -n "$BASH" && -s "$HOME/.bashrc" ]] && . "$HOME/.bashrc"
OK, lets check our setup:
$ bash -l
$ which rvm
/home/user/.rvm/bin/rvm
Seems to work, nice! But before we can install our first Ruby version, we also
need to tell RVM about doas and we need to adjust how autogen.sh is called:
$ patch -p0 <<EOF
--- .rvm/scripts/functions/support Tue Dec 30 19:25:59 2025
+++ .rvm/scripts/functions/support Tue Dec 30 19:42:48 2025
@@ -347,6 +347,26 @@
fi
}
+__rvm_setup_sudo_function_OpenBSD()
+{
+ if
+ __rvm_which doas &>/dev/null
+ then
+ __rvm_sudo()
+ {
+ if [[ \$1 == "-p" ]]; then
+ shift 2
+ fi
+ \\command \\doas "\$@"
+ }
+ else
+ __rvm_sudo()
+ {
+ \\command \\sudo "\$@"
+ }
+ fi
+}
+
__rvm_setup_sudo_function_Other()
{
if
EOF
$ patch -p0 <<EOF
--- .rvm/scripts/functions/manage/base_install Tue Dec 30 20:03:13 2025
+++ .rvm/scripts/functions/manage/base_install Tue Dec 30 22:08:40 2025
@@ -49,12 +49,22 @@
if
[[ -s "\${rvm_src_path}/\$rvm_ruby_string/autogen.sh" ]]
then
- __rvm_log_command "autogen.sh" "\$rvm_ruby_string - #autogen.sh" "\${rvm_src_path}/\$rvm_ruby_string/autogen.sh" ||
- {
+ if [[ "\${_system_name}" == "OpenBSD" ]]; then
+ if [[ -z "\$AUTOCONF_VERSION" ]]; then
+ AUTOCONF_VERSION=\$(ls /usr/local/bin/autoreconf-* | cut -f2 -d"-")
+ fi
+ __rvm_log_command "autogen.sh" "\$rvm_ruby_string - #AUTOCONF_VERSION=\$AUTOCONF_VERSION sh autogen.sh -i" \\
+ "AUTOCONF_VERSION=\$AUTOCONF_VERSION" "sh" "autogen.sh" "-i"
result=\$?
+ else
+ __rvm_log_command "autogen.sh" "\$rvm_ruby_string - #autogen.sh" "\${rvm_src_path}/\$rvm_ruby_string/autogen.sh"
+ result=\$?
+ fi
+
+ if (( \$result != 0 )); then
rvm_error "There has been an error while running autogen.sh. Halting the installation."
return \$result
- }
+ fi
fi
EOF
Now we can finally install Ruby. I’ll install version 3.3.10 as this seems
to work well with the dusty Jekyll 3.10 version I’m using to build this
website.
$ rvm install 3.3.10
After successful installation rvm list should reference ruby-3.3.10:
$ rvm list
=* ruby-3.3.10 [ x86_64 ]
# => - current
# =* - current && default
# * - default
A quick test:
$ which ruby
/home/user/.rvm/rubies/ruby-3.3.10/bin/ruby
$ ruby --version
ruby 3.3.10 (2025-10-23 revision 343ea05002) [x86_64-openbsd7.8]
…and we’re done. Happy hacking!