Here's the environment we'll play with (just an excuse to use
The packages are handy but I'd prefer to keep the installation within my home in order to make actions like
bundle install work without the need for super user permissions or custom configurations.
Also, I don't mind reducing the number of indirection layers.
First of all prepare the directory in which we'll install Ruby.
$ mkdir ~/.rubies
Note that we're doing this to avoid the need for the superuser.
Then download the sources of the latest version (3.0.2) and install them into our user directory:
$ curl -LO https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.2.tar.gz $ tar xvfz ruby-3.0.2.tar.gz $ cd ruby-3.0.2 $ ./configure --prefix ~/.rubies/3.0.2 $ make $ make install
For convenience, link the newly installed version with the "current" alias:
$ ln -s $HOME/.rubies/3.0.2 $HOME/rubies/current
~/.profile and add
$HOME/.rubies/current/bin to the
$PATH so that the binaries will more easily be available in the terminal:
PATH=$HOME/.rubies/current/bin:$HOME/bin:__the rest of the path list here__
Here's our little precious:
$ ruby -v ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-openbsd6.9]
Using the same approach described for FreeBSD in https://nokogiri.org/tutorials/installing_nokogiri.html#installing-using-standard-system-libraries we'll install the
pkgconf package (note that the current user needs to be enabled for
$ doas pkg install pkgconf $ gem install nokogiri --platform=ruby -- --use-system-libraries
Time to test that the big boy works (picking "rails API only" to make things simpler):
$ gem install rails $ rails new --api yolo $ cd yolo $ rails server
Now open another terminal (or the browser at http://localhost:3000) and enjoy the view:
$ curl http://localhost:3000