rbenv

git clone https://github.com/rbenv/rbenv.git ~/.rbenv

Put the following in your .bashrc

~/.rbenv/bin/rbenv init

Then install the ruby-build plugin so that you can install new versions.

git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build

Libyaml

Libyaml fails to install, even though the pkgmanager shows that it’s installed. Nevermind, simply download from the website, compile it and install it. Then tell the ruby compiler where it lives. https://pyyaml.org/wiki/LibYAML

wget http://pyyaml.org/download/libyaml/yaml-0.2.5.tar.gz
tar xvf yaml-0.2.5.tar.gz
cd yaml-0.2.5
./configure
make
make install
export RUBY_CONFIGURE_OPTS=--with-libyaml-dir=/usr/local/lib
rbenv install 3.4.1

Postgresql

You can install most of the packages from the pkgmanager, including postgis. However libpq-dev is missing. Download this from the debian website. https://packages.debian.org/bookworm/libpq-dev

Install it and then run this

gem install pg -- --with-pg-lib=/usr/lib/postgresql/15/lib