Fixing: uninitialized constant OpenSSL::Digest::DSS on Mac OS Sierra

I recently installed Ruby (via RVM) on a Mac I use for work, and upon trying to run rails (after the usual bundle install) I got the following error:

There was an error while trying to load the gem 'secure_string'. (Bundler::GemRequireError)
Gem Load Error is: uninitialized constant OpenSSL::Digest::DSS

Strange, because I'm running all the same versions of RVM, Ruby and the project on others computers, albeit they are running Ubuntu.

A fuller stack trace is below:

paul.ridgway@pdr [10:22:05] [~/Documents/Code/project/project] [development *]
-> % bundle exec rails s
/Users/paul.ridgway/.rvm/gems/ruby-2.4.1@project/gems/bundler-1.15.3/lib/bundler/runtime.rb:85:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'secure_string'. (Bundler::GemRequireError)
Gem Load Error is: uninitialized constant OpenSSL::Digest::DSS
Backtrace for gem load error is:
/Users/paul.ridgway/.rvm/gems/ruby-2.4.1@project/gems/secure_string-1.3.3/lib/securize_string/digest_finder.rb:8:in `<class:DigestFinder>'
/Users/paul.ridgway/.rvm/gems/ruby-2.4.1@project/gems/secure_string-1.3.3/lib/securize_string/digest_finder.rb:6:in `<module:SecurizeString>'

[snip]

/Users/paul.ridgway/Documents/Code/project/project/config/application.rb:16:in `<top (required)>'

[snip]

	from bin/rails:4:in `<main>'

As always my first step was to Google the error - but there is surprisingly little around. Quite a lot of articles talked about the issues and nuances around changing OpenSSL versions, but none spoke to this exact issue.

Having a poke around with irb it seems that OpenSSL exists and much of it appears fine but the DSS constant is not there.

2.4.1 :001 > require 'secure_string'
NameError: uninitialized constant OpenSSL::Digest::DSS
	from /Users/paul.ridgway/.rvm/gems/ruby-2.4.1/gems/secure_string-1.3.3/lib/securize_string/digest_finder.rb:8:in `<class:DigestFinder>'
[snip]

2.4.1 :002 > OpenSSL
 => OpenSSL
2.4.1 :003 > OpenSSL::Digest::MD5
 => OpenSSL::Digest::MD5
2.4.1 :004 > OpenSSL::Digest::DSS
NameError: uninitialized constant OpenSSL::Digest::DSS
	from (irb):4
	from /Users/paul.ridgway/.rvm/rubies/ruby-2.4.1/bin/irb:11:in `<main>'

After a number of failed attempts including messing with autolibs in RVM the following worked:

rvm reinstall 2.4.1 --with-openssl-dir="$(brew --prefix openssl)"

Afterwards, do the usual bundle install and bundle exec rails s and all is well again.