1. Open the Terminal app on your Mac.
2. Type “sudo nano /private/etc/hosts”.
3. Enter the administrator password for your user account.
4. Enter the IP address and hostname you need in the hosts file. For example:
<IP address> <hostname>
10.8.4.2 server1
5. Press “Control + X” and then “Y” to save the changes.
6. Type “sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder” or “sudo killall -HUP mDNSResponder” or shutdown and restart your Mac.