When I install ruby 2.7.0, it says kernel_require.rb:92:in `require': cannot load such file

I installed ruby ruby 2.6.3p62 on MacOS. and I wanna update it to 2.7.0.
I downloaded tar.gz, and then build and install it as this Page describes: https://www.w3cschool.cn/ruby/ruby-installation-unix.html

when it is installing ruby 2/7/0, the throws error saying that:
ruby-2.7.0/lib/rubygems/core_ext/kernel_require.rb:92:in `require’: cannot load such file – openssl ( LoadError )
make: *** [do-install-all] Error 1

For debian 10 Mx linux :

sudo apt-get install -y libssl-dev