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.

OS X DNS cache reset script

125 pointsby mikethemanalmost 9 years ago

15 comments

cel1nealmost 9 years ago
In 10.10 Apple replaced the then 12-year-old mDNSResponder, which does DNS (apart from other things) with &quot;discoveryd&quot;, which had issues so they reverted the change.<p><a href="http:&#x2F;&#x2F;arstechnica.com&#x2F;apple&#x2F;2015&#x2F;01&#x2F;why-dns-in-os-x-10-10-is-broken-and-what-you-can-do-to-fix-it&#x2F;" rel="nofollow">http:&#x2F;&#x2F;arstechnica.com&#x2F;apple&#x2F;2015&#x2F;01&#x2F;why-dns-in-os-x-10-10-i...</a><p><a href="http:&#x2F;&#x2F;arstechnica.com&#x2F;apple&#x2F;2015&#x2F;05&#x2F;new-os-x-beta-dumps-discoveryd-restores-mdnsresponder-to-fix-dns-bugs&#x2F;" rel="nofollow">http:&#x2F;&#x2F;arstechnica.com&#x2F;apple&#x2F;2015&#x2F;05&#x2F;new-os-x-beta-dumps-dis...</a><p><a href="https:&#x2F;&#x2F;support.apple.com&#x2F;en-us&#x2F;HT202516" rel="nofollow">https:&#x2F;&#x2F;support.apple.com&#x2F;en-us&#x2F;HT202516</a>
评论 #11902696 未加载
pschastainalmost 9 years ago
What a worthless link. How about an explanation of the problem? Stop what? Not resetting? Why is a reset necessary? And why the double-negative? Why not &quot;noreallyjustfuckingresetitalready&quot;?
评论 #11903341 未加载
评论 #11903258 未加载
评论 #11902878 未加载
akshatpradhanalmost 9 years ago
Too bad they didn&#x27;t address the DNS problem in the Keynote. This is a bit of an exaggeration, but I do feel I&#x27;ve spun mDNSResponder more often than using their Messages app.<p>That&#x27;s not a positive feeling. Especially if you&#x27;re with a client and your browser stops resolving and your client is watching you open up terminal to spin mDNSResponder
germanieralmost 9 years ago
Could someone add some context please? I see that apparently the method to flush the DNS cache changes between versions. Is there a deeper reason why this is necessary?
评论 #11902669 未加载
评论 #11902641 未加载
评论 #11902650 未加载
dgantalmost 9 years ago
What&#x27;s the context of this?
评论 #11902639 未加载
评论 #11902619 未加载
评论 #11902636 未加载
justinsaccountalmost 9 years ago
I&#x27;d just do<p><pre><code> dscacheutil -flushcache || \ discoveryutil mdnsflushcache || \ killall -HUP mDNSResponder</code></pre>
评论 #11902715 未加载
lamontcgalmost 9 years ago
Could OSX just have a way to disable negative caching completely? All it does is troll me when I&#x27;m on bad wifi and the DNS lookup for www.google.com gets dropped and that negative response is cached. Can we just stop doing that?<p>I can&#x27;t recall the last time I had a positive cache entry issue, but the last time the dropped DNS lookup for www.google.com happened to me was like 2 days ago...
bluedinoalmost 9 years ago
Actually, this should be included with the Mavericks+ version<p><pre><code> sudo discoveryutil udnsflushcaches</code></pre>
protomythalmost 9 years ago
This is quite nice (I went with an alias myself). Does anyone know if it changed again in macOS?
评论 #11902701 未加载
评论 #11902698 未加载
nickhalfasleepalmost 9 years ago
Also, just think about how we get all new browser user agents because of this.
coherentponyalmost 9 years ago
It&#x27;s good practice to include<p><pre><code> set -eu set -o pipefail </code></pre> to avoid the default ON ERROR RESUME NEXT behaviour of bash.
评论 #11903461 未加载
评论 #11906118 未加载
评论 #11902880 未加载
jrciialmost 9 years ago
I have in my .bash_profile for this purpose: alias cleardns=&#x27;dscacheutil -flushcache&#x27; but this solution is way funnier.
评论 #11902761 未加载
underyxalmost 9 years ago
&gt;(or whatever your name is)<p>Why is changing names seen as a negative thing? My company also changed its name a month ago, and several customers leaving negative feedback said included this phrase or something similar, while to my recollection none of the positive feedback (which we have way more of) took mention of the name change.
评论 #11902782 未加载
评论 #11902974 未加载
评论 #11902732 未加载
评论 #11902725 未加载
评论 #11902731 未加载
blakesterzalmost 9 years ago
<p><pre><code> echo &quot;¯\_(ツ)_&#x2F;¯&quot; </code></pre> Something about seeing the shrug emoji in code just cracks me up every time.
评论 #11902597 未加载
评论 #11902718 未加载
mikethemanalmost 9 years ago
Someone renamed this. Why?
评论 #11902970 未加载