What do you use to install ruby for local development?

I had been using rbenv and rvm to manage different ruby versions in my local environment (OSX) but encountered issues frequently with the configuration.

Currently, I’m using mise to install ruby versions without problems but I’m curious to learn about issues or limitations others might have and also interested in recommendations if you’re using something different that you would recommend.

1 Like

I tend towards the unix philosophy a bit here. Small composable tools. So I’ve stuck with the *env variants (rbenv, pyenv, nodenv, goenv), and stitched their installation together with an ansible recipe. So I have one command to install them all on a new system. And then they have only the lightest interaction with my environment with their injection of a shims directory into my PATH. So very simple, so easy to understand.

I can’t speak to the OSX woes, because I’m in linux. Having my workstation running the same OS as my server makes for fewer surprises. And without even involving containers!

rbenv.yaml Ansible Recipe (debian)

---
- name: ruby build dependencies
  apt:
    pkg:
      - git
      - build-essential
      - libssl-dev
      - zlib1g-dev
      - libreadline-dev
      - libffi-dev
      - libyaml-dev
      - libgdbm-dev
      - libncurses5-dev
  become: true
- name: rbenv (clone)
  shell: git clone https://github.com/rbenv/rbenv.git ~/.rbenv
  args:
    creates: ~/.rbenv
- name: rbenv-build (dir)
  shell: mkdir -p ~/.rbenv/plugins
- name: rbenv-build (clone)
  shell: git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
  args:
    creates: ~/.rbenv/plugins/ruby-build
- name: compile bash extensions
  shell: cd ~/.rbenv && src/configure && make -C src
  args:
    creates: ~/.rbenv/src/realpath.o
- name: init zsh path
  lineinfile:
    path: ~/.zshlocal
    line: 'export PATH="$HOME/.rbenv/bin:$PATH"'
    create: yes
- name: init rbenv
  lineinfile:
    path: ~/.zshlocal
    line: 'eval "$(rbenv init -)"'
- name: install ruby
  shell: zsh -lc 'rbenv install -s 4.0.0'
- name: global ruby
  shell: zsh -lc 'rbenv global 4.0.0'


1 Like

i have tried vfox version package manager . that was great.

Long-time rvm user here, and I too made the switch to mise at some point last here. So far it’s working without any issues, I’m enjoying the env config and ability to manage more than Ruby with it

1 Like

I use RVM but lately I’ve been keeping an eye on rv

2 Likes

If you haven’t tried rv, you should. It installs precompiled versions of Ruby in seconds.

Thanks everyone for the suggestions!

@alan The ansible recipe is an interesting approach I haven’t considered!

@mentalizer Being able to manage other tools is def a great advantage.

@yegorov @alan rv is def on my “watch list” but haven’t had the chance to test it yet.

@yegorov @alan thanks for calling out rv! We’ve just shipped “frozen” bundle installation, and we’re finishing up support for CLI tools right now. When tool support ships, you’ll be able to use CLI tools written in Ruby without worrying about a dependency conflict, or the underlying Ruby version, or OpenSSL or libyaml suddenly breaking.

We’ve got support for Mise on the roadmap too, so we’ll be able to provide precompiled binary Rubies in just a second or two.

3 Likes

I’m using mise. I used asdf before that. It is so nice to have one tool with a unified cli to install all of the various dependencies across projects (node, ruby, postgres, redis, pnpm, etc.).

2 Likes

I use Mise for both Ruby and JS. The big advantage there is that I can use Mise’s tasks system to build little helper tasks for each of my projects.

1 Like

I’m using rbenv works for me.

I’m going to check mise and rv.

I am also using rbenv but I will definitely check mise

I have been using rbenv for ages, but ultimately switched first to asdf, then to mise. I’m curious about rv though.

I started with RVM and continue with it :sweat_smile: