Hadoop on MAC pseudo node : nodename nor servname provided, or not known
You can fix this with a simple command:
echo "127.0.0.1 $HOSTNAME" | sudo tee -a /etc/hosts
(Source)
The problem was with the host file. Fixed it by adding this to the /etc/hosts file:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
127.0.1.1 <hostname>