TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Using Dnsmasq for local development on OS X

46 pointsby Coutoabout 11 years ago

19 comments

sexmonadabout 11 years ago
I use "lvh.me" - it has a wildcard DNS record to redirect any subdomain to localhost. So I'll use something like "example.com.lvh.me" to test.
gnufiedabout 11 years ago
I wrote - <a href="http://invoker.codemancers.com/" rel="nofollow">http:&#x2F;&#x2F;invoker.codemancers.com&#x2F;</a> for similar use. It provides easy to use `.dev` local domain support and then ability to manage multiple processes via a Procfile or custom ini file.
评论 #7628847 未加载
ironladyabout 11 years ago
I&#x27;ve been doing this for about a year or so now and its honestly the best solution for local development I&#x27;ve used in my career.<p>Recently I&#x27;ve started using Vagrant for more complex sites that require custom server software, or are based outside the traditional LAMP stack, but a Dnsmasq based setup on my mac is still my favorite for most sites.
javanabout 11 years ago
For Ruby apps, there&#x27;s also <a href="http://pow.cx/" rel="nofollow">http:&#x2F;&#x2F;pow.cx&#x2F;</a>
评论 #7628667 未加载
评论 #7627778 未加载
评论 #7629259 未加载
iambytemanabout 11 years ago
I&#x27;ve been experimenting with this lately. I have been using dnsmasq to server up domains in my &#x2F;etc&#x2F;hosts file to local virtual machines for testing on different platforms without having to mess around with the hosts file in each virtual machine.<p>I am about to loop back around to a mobile project and I am hoping I can use it to tests my mobile app interactions with my local development box more easily than I have been able to in the past.
Spittieabout 11 years ago
Another neat &quot;trick&quot; with dnsmasq is to redirect all the dns request for your domain to your dns provider when you&#x27;re working with dns records (config needed: server=&#x2F;example.com&#x2F;176.124.112.100). Never wait for dns propagation anymore! Beat switching your system&#x27;s dns to your provider because those could be slow for you, or could not answer domains that aren&#x27;t in their database.
magnetikonlineabout 11 years ago
I do something similar with Ubuntu 12.04&#x2F;14.04 which uses Dnsmasq via the NetworkManager service. These steps help make Dnsmasq a little more useful - reading &#x2F;etc&#x2F;hosts and allowing it to listen on your hosts IP address for use in guest VM&#x27;s<p><a href="https://gist.github.com/magnetikonline/6236150" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;magnetikonline&#x2F;6236150</a>
josephbyabout 11 years ago
Or you could use ettercap to redirect all DNS requests for any device on your local network. That&#x27;s how I test iPhone, iPad, and Android applications when the services needed don&#x27;t have DNS entries: <a href="http://joseph.by/post/83414951259/effectively-edit-hosts-file-with-ettercap-on-mac" rel="nofollow">http:&#x2F;&#x2F;joseph.by&#x2F;post&#x2F;83414951259&#x2F;effectively-edit-hosts-fil...</a>
joshkaabout 11 years ago
Great article for highlighting the dnsmasq on OSX idea. I wasn&#x27;t aware that you could run this there.<p>On the goal of having unlimited easy to configure real domains that point to locahost, another service of interst is localtest.me [1]. This offers *.localtest.me -&gt; 127.0.0.1<p>[1]: <a href="http://readme.localtest.me/" rel="nofollow">http:&#x2F;&#x2F;readme.localtest.me&#x2F;</a>
评论 #7627675 未加载
joevandykabout 11 years ago
One problem I&#x27;ve been running into: I have a virtual machine (linux running in vmware fusion on osx). I have dev.site.com in &#x2F;etc&#x2F;hosts. The vm is set to use a private network on the vm (as I don&#x27;t want the ip address to change when I switch networks). How can I setup my phone to load dev.site.com and have it work while keeping the private network setup?
评论 #7629352 未加载
arb99about 11 years ago
Doesn&#x27;t do the exact same (you&#x27;d have to add a new entry everytime, rather than point *.dev to localhost) but <a href="https://addons.mozilla.org/en-US/firefox/addon/hostadmin/" rel="nofollow">https:&#x2F;&#x2F;addons.mozilla.org&#x2F;en-US&#x2F;firefox&#x2F;addon&#x2F;hostadmin&#x2F;</a> is easier to set up. It&#x27;ll flush the dns cache everytime its changed.
评论 #7628076 未加载
eswatabout 11 years ago
Well, that’s one part of the equation. Are there any guides on what to do after; setting up virtual hosts?
评论 #7627776 未加载
评论 #7628287 未加载
raamdevabout 11 years ago
<a href="http://dev.sh" rel="nofollow">http:&#x2F;&#x2F;dev.sh</a> has a nice auto-setup script for this.
dshankarabout 11 years ago
Genuinely curious: when &amp; why would I want to use myproject.dev:port over localhost:port?
评论 #7629243 未加载
aalvaradoabout 11 years ago
I wrote a little post for myself on the same topic, detailing how to get this working on Linux (Ubuntu &amp; variants). <a href="https://coderwall.com/p/6dgpsw" rel="nofollow">https:&#x2F;&#x2F;coderwall.com&#x2F;p&#x2F;6dgpsw</a>
freshyillabout 11 years ago
I use virtualhost.sh, which is available via homebrew. Maybe the use case is a bit different, but it seems a heck of a lot easier for most uses.
r4umabout 11 years ago
Another neat tool&#x2F;trick <a href="http://xip.io/" rel="nofollow">http:&#x2F;&#x2F;xip.io&#x2F;</a>
etchalonabout 11 years ago
Maybe I&#x27;m missing something, but…<p>…how is this different from editing &#x2F;etc&#x2F;hosts?
评论 #7628051 未加载
taylorbuleyabout 11 years ago
What are the advantages of using an approach like this vs. editing &#x2F;etc&#x2F;hosts directly?
评论 #7627815 未加载
评论 #7629307 未加载
评论 #7628836 未加载