How do I refresh the hosts file on MacOS?

Follow these steps bellow.

  • nano /etc/hosts
  • type: 127.0.0.1        apple.dev
  • save hosts file, press ctrl+x and then press y, the last one press enter
  • type: dscacheutil -flushcache (enter)
Test on your terminal, type: ping apple.dev (enter)

another way reload system file:
  • source ./bash_profile
  • touch ./bash_profile
  • dscacheutil -flushcache

Source:
https://superuser.com/questions/346518/how-do-i-refresh-the-hosts-file-on-os-x

Comments