Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 stackoverflow.com Oct 14 '11 at 11:22

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

up vote 48 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 yourdomain.com still gives you the wrong IP, try clearing your DNS cache:

dscacheutil -flushcache
share|improve this answer
    
For clearing dns cache, see: support.opendns.com/entries/… – 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.