How to install an older version of ruby on Mac Ventura

I am trying to open an old Rails 5 app. I haven't code for years and it's hard to remember... Also I have a new computer (mac 0S Ventura) and I had to reinstall hombrew, xcode, ruby etc... The ruby version of this app was ruby '2.4.4'

I am fixing little by little the problems but I am stuck there:

When I try to install an older version of ruby i have this :

rbenv install 2.4.4                                                                                                                                                    [(3.2.2)]
To follow progress, use 'tail -f /var/folders/bh/wbvn20493_s066frg6c2wwx00000gn/T/ruby-build.20230615201145.8783.log' or pass --verbose
Downloading ruby-2.4.4.tar.bz2...
Installing ruby-2.4.4...

WARNING: ruby-2.4.4 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.

BUILD FAILED (macOS 13.4 using ruby-build 20230615)

Inspect or clean up the working tree at /var/folders/bh/wbvn20493_s066frg6c2wwx00000gn/T/ruby-build.20230615201145.8783.nJ19PV
Results logged to /var/folders/bh/wbvn20493_s066frg6c2wwx00000gn/T/ruby-build.20230615201145.8783.log

Last 10 log lines:
../.././include/ruby/ruby.h:1753:56: note: expanded from macro 'rb_intern'
        __extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
closure.c:263:14: error: call to undeclared function 'ffi_prep_closure'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    result = ffi_prep_closure(pcl, cif, callback, (void *)self);
6 warnings and 1 error generated.
make[2]: *** [closure.o] Error 1
make[1]: *** [ext/fiddle/all] Error 2
make: *** [build-ext] Error 2


  • As others have mentioned, Ruby 2.4.4 is very old, and it's best to try to install a newer version, then update your Rails app to use that newer version. If that's feasible, I wrote a detailed step-by-step guide that goes over How and Why to Upgrade the Ruby Version in Your Project.

    However, it's understandable that you might want to get your Rails app running with 2.4.4 first, and then update it little by little to newer versions of Ruby and Rails. In that case, it's definitely possible to install 2.4.4 on macOS Ventura, and it's much easier than versions 2.3.8 and older. I explain this in my guide to installing older Ruby versions on macOS.

    Another thing to keep in mind is that there are several Ruby version managers, and they don't all work the same. They all have different pros and cons. I see that you tried to install Ruby 2.4.4 with rbenv. I personally recommend ruby-install because it's the most reliable. I just used it to install Ruby 2.4.10 successfully on my M1 Mac with Rosetta by running ruby-install 2.4.10.

    As I explain in my article about upgrading your Ruby version, you always want to use the latest patch version for any given Ruby version. The patch version is the 3rd digit. In your case, since you're using Ruby 2.4, you want to use the latest possible in the 2.4.x series, which is 2.4.10.

    Here's how to install it:

    If you have an Intel Mac, here are the high level steps:

    1. Completely uninstall rbenv and any other version managers you might have installed

    2. Quit and restart Terminal

    3. Install ruby-install and chruby with brew install ruby-install chruby.

    4. Install 2.4.10 with ruby-install 2.4.10.

    5. Configure your shell startup file to use chruby

    6. Follow my guide for upgrading your Ruby version to update your Rails app from 2.4.4 to 2.4.10

    For a more detailed step-by-step guide, read my guide to installing older Ruby versions on macOS.

    If you have an Apple Silicon Mac with the M1 or M2 chip, you'll need to run Terminal with Rosetta and reinstall all dev tools over again, including Homebrew. To run Terminal with Rosetta, follow these steps:

    1. Quit Terminal if it’s running

    2. Go to the Finder

    3. Go to the Utilities folder by pressing shift-command-U (or select “Go” from the menu bar, then select Utilities)

    4. Click once on the Terminal app to select it, but don’t launch it.

    5. Press the ⌘-i keyboard shortcut to open the Info window (or from the menu bar: “File”, then “Get Info”).

    6. Check the checkbox that says “Open using Rosetta”

    7. Close the Terminal Info window

    8. Launch Terminal

    9. Run arch. It should say i386

    You can now install Homebrew, which will detect that you're using Rosetta and will install everything in /usr/local instead of /opt/homebrew.

    Then follow the same steps as in the Intel section.

    Alternatively, you can use Docker as mentioned in the comments above. I don't use Docker personally, so I don't have a detailed tutorial, but I know there are plenty out there that show how to set up Docker for a Rails app.