Here is a set of commands i ran to get ruby 3.2.2 installed on my macbook with m2 chip.
which openssl
# /Users/razvan/miniforge3/bin/openssl
rvm reinstall "ruby-3.2.2" --with-openssl-dir=/Users/razvan/miniforge3/bin/openssl
I tried installing openssl like this: