I’ve had a number of issues with my macports, ruby and rails setup after I updated the OS to 12.1. First I want to document some things that helped me to figure out some of my problems.

MACPORTS To list the files in a given port, use contents.

$ port contents installed_port_name

To list all my installed ports

$ port installed

To activate a particular port

$ port activate <portname> @<version>

RUBY To list available versions of a port to install

$ gem list <gemname> -remote

To find out the version of openssl that ruby is using

$ ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'

This last bit is what was causing my issue. I was trying to run a capistrano task to set up the directories for an app and I got this error.

yo:apcases  [master]$ cap production setup:directories
00:00 setup:directories
      01 /bin/mkdir /local/web/apcases/shared
#<Thread:0x000000010f8cb3c8 /Users/maryh/Software/rubies/3.1.0/lib/ruby/gems/3.1.0/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
/Users/maryh/Software/rubies/3.1.0/lib/ruby/gems/3.1.0/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as user@host.domain: rsa#set_key= is incompatible with OpenSSL 3.0 (SSHKit::Runner::ExecuteError)
...
lots of other stuff...

After looking at the server to see what was installed, I found that the only place I had openssl3 installed was on my laptop. I had recently updated my laptop to MacOS 12.1 (Monterey) and had to reinstall MacPorts. I also had updated my ruby to 3.1. After a lot of searching, I found that the version of ruby that I was using had openssl3.

be:~ $ ~/Software/rubies/3.1.0/bin/ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'
OpenSSL 3.0.1 14 Dec 2021

I recompiled ruby with the following config options to fix things.

 $ ./configure --prefix=/Users/maryh/Software/rubies/3.1.0-openssl11 --with-openssl-dir=/opt/local/libexec/openssl11
 be:~ $ ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'
OpenSSL 1.1.1l  24 Aug 2021

Then I just needed to install all the required gems and I was back in business.