DEV Community

Mick F
Mick F

Posted on

Installing/maintaining Ruby on macOS with a script

Still working on a reinstall, here is my script to setup Ruby on macOS.

Terminal Demo

Prerequisite:

  • rbenv is installed and ready to go;
  • gum is installed.

The script to pick a version of Ruby to install and actually installing it is:

picked_version=$(rbenv install -l | gum choose)

install_ruby()
{
    rbenv install --skip-existing "$picked_version"
    rbenv global "$picked_version"
}

gum confirm "Install Ruby version $picked_version?" && install_ruby
Enter fullscreen mode Exit fullscreen mode

Top comments (0)