I was having the same issue on my mac. I found the issue when I pinged my $HOSTNAME from terminal and it returned ping: cannot resolve myHostName: Unknown host.
To resolve:
-
Do
echo $HOSTNAMEon your terminal. -
Whatever hostname it shows (lets say
myHostName), try to ping it :ping myHostName. If it returnsping: cannot resolve myHostName: Unknown hostthen add an entry into your/etc/hostsfile. -
For that edit
/etc/hostsfile and add following:127.0.0.1 myHostName