I am using osx 10.8.2 installed ruby 2.0 and.... got this when trying to run \"sudo gem install rails\"
$
just went through the same problem. Takes a bit time but, upgrading openssl with
brew upgrade openssl@1.1
worked for me. Version might be different in the future, type brew install openssl to see which version you can upgrade to. I hope it helps.