Slow BrowserSync in OS X with apache or nginx?

I’ve been testing out gulp.js some with BrowserSync for front end development on a new project. I saw a nice a video about it and got the feeling it would be a really nice workflow. But my BrowserSync proxy setup towards my local Apache site (php+mysql) was for some reason really really slow. The video showed an example using Node.js which was instant so to test that out I created a Node.js site and started gulp towards it. And the difference was like a really slow night and a really fast day. It was instant.

After much search and many Google I found this thread on Stack Overflow about someone having an issue with slow localhost/virtualhost load/resolve. And this reply:

I had the exact same problem and it was driving me crazy!

Put all your hosts file entries for localhost into one line like so: localhost myproject.dev myotherproject.dev
::1 localhost
fe80::1%lo0 localhost

Worked like a charm for me. Seems like a bug in Lion.

Because of my many web projects and my fondness of local development I have a lot of different virtual hosts. All pointing to All on different rows. So I went in to my /etc/hosts file and changed it. And behold. It worked. So now I can do my BrowserSync, sass powered, js minifying, gulp induced, front end development without coffee breaks in between changes. Which is really nice. I don’t even drink coffee.

Posted by David