Add Custom Domain to HOST file on OS X (Leopard)

  1. Open Terminal.app
  2. Type: sudo vim /etc/hosts
  3. Hit return
  4. Type your password when prompted for it
  5. Press i (this will put in into insertion mode)
  6. Scroll down to a blank line
  7. Type in the ip and domain for the site you want to redirect using the following format: (i.e. 127.0.0.1 blueoceanlabs.com)
  8. Press escape
  9. Type :wq (this saves and quit vim)
  10. Type: dscacheutil -flushcache
  11. Hit return
  12. Test the domain in your browser, should point to new server

Leave a Reply