Can't stop making
Home

Setting up wildcard DNS forwarding on your development Mac OSX

It's a typical project, we usally add xyz.local into the hosts file on OSX, but in fact, you can just use a wildcard by doing the following:

(Assuming you already have macports installed, no I don't like brew)

sudo port install dnsmasqsudo port load dnsmasqsudo cp /etc/resolv.conf /etc/resolv.dnsmasq.confsudo vi /etc/resolv.dnsmasq.conf

Make sure you have: (if you use Google DNS servers)

nameserver 8.8.8.8
nameserver 8.8.4.4 

sudo vi /opt/local/etc/dnsmasq.conf

Add

address=/.test/127.0.0.1
listen-address=127.0.0.1
resolv-file=/etc/resolve.dnsmasq.conf #(replace existing line with this) 

 (Please note don't use .local because Apple decided they own .local... bastards: http://support.apple.com/kb/TA20999?viewlocale=en_US)

Personally I have another address= line to redirect another testing domain to a VM that's running a proper production environment that you can't replicate in OSX as well. Remember to flush the cache after this if it ain't working.

標籤 tag(s)

  • Mac OSX

Version

1.0

Last Updated

16th October, 2011

First Published

16th October, 2011

Comments

Leave a comment

Any published comments will adhere to the etiquette policy and all e-mail addresses will be treated in accordance to the privacy policy.

  • If you see this, something's wrong with Twitter.

Blatant Plug

Need a new CPU or graphics card? Get AMD.

AMD Vision and AMD Radeon Graphics

Support

I've pledged my support to these organisations, and I think you should too.

  • Google+
  • Follow ronaldslc on Twitter
  • View Ronald Chan's profile on LinkedIn