Simon Davies Digital ltd

Using MAMP and Pow on the same machine

Posted by & filed under MAMP.

I’ve been playing with Ruby on Rails recently and I’ve been using Pow as a rack server for the applications I’m working on. So I don’t have to keep running “rails server” when I want to test an app out. It’s a brilliant little tool from 37 Signals that they describe as a zero-config rack server and it is just that.

The only drawback to Pow is that it highjacks all localhost requests, this means that working with MAMP and Pow simultaneously can be tricky. The easiest and simplest solution would be to leave the MAMP port for apache to the default 8888 so you can access your htdocs folder from http://localhost:8888/

This works fine but it annoys me having to add the port number to all urls, so after a little bit of reading I discovered that Pow only hijacks IPv4 localhost not IPv6 so if we create our hostnames using IPv6 we should be able to get around this. Open up terminal and edit your hosts file, on the mac this is in /etc/hosts.

sudo mate /etc/hosts

Obviously change mate to your editor of choice. Then from here we need to change any hostnames using the old IPv4 loopback (127.0.0.1) to the new IPv6 loopback (::1). For example change

127.0.01     example.test

to

::1          example.test

If you are using Safari or FireFox then this should now be working, if like me you are using Chrome then you will need to enable IPv6. You do this by adding chrome://net-internals/ to your address bar, then go to the DNS page and click the enable IPv6 button. Annoyingly this needs to be done every time chrome is restarted, if anyone knows how to enable this be default I would love to hear in the comments below.

  • Alternatively you can use powder (https://github.com/Rodreegez/powder) to start and stop Pow when you need to use MAMP. There’s also a free little Mac App to act as a GUI for that – http://anvilformac.com/

    • Chris Krycho

      Said Mac app, at least for me, didn’t do the trick—Anvil either wasn’t turning Pow off successfully for me, or there was something else goofy going on. Switching all the sites over to ::1 did the trick nicely even so.

Contact

Want to hear more about Simon Davies Digital and what we can do for your business or simply want to say hello, then get in touch.

+44 7846 400933
hello@simon-davies.name