Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to develop using subdomains on OSX but don't want to reboot the computer to refresh the hosts file. Normally on linux I'd do /etc/init.d/networking restart but I can't figure out how to do this on OSX.

share|improve this question

migrated from Oct 14 '11 at 11:22

This question came from our site for professional and enthusiast programmers.

up vote 51 down vote accepted

You don't need to. Simply sudo vim /etc/hosts, change what you need to change and go on. Your changes will be applied instantly.

If ping still gives you the wrong IP, try clearing your DNS cache:

dscacheutil -flushcache
share|improve this answer
For clearing dns cache, see:… – Romans-8---31-39 Sep 20 '14 at 21:36
Make sure you obviously use the right order too (IP address, then DNS). – user1442960 Dec 12 '14 at 23:03

For El Capitan, go to the Terminal app and type:

sudo killall -HUP mDNSResponder


share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .