ERROR: While executing gem (Errno::ECONNREFUSED) Connection refused - recvfrom(2)

Hello I'm trying to install bundler using this command

gem install bundler

Once i run the command this comes out

ERROR: While executing gem ... (Errno::ECONNREFUSED)
    Connection refused - recvfrom(2)


The typical cause of this issue is something that makes an SSL connection to fail. It’s hard to say more without additional information: your copy of Ruby may have been installed without OpenSSL, the certificate that issued the one used by may not be trusted by your machine, a proxy server along the way could be misconfigured.

–Matt Jones