<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Terminal on NetUtil</title>
    <link>https://www.netutil.app/ja/tags/terminal/</link>
    <description>Recent content in Terminal on NetUtil</description>
    <generator>Hugo</generator>
    <language>ja</language>
    <lastBuildDate>Sat, 16 May 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://www.netutil.app/ja/tags/terminal/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>macOS（Sequoia、Sonoma、Ventura）で DNS キャッシュをフラッシュする方法</title>
      <link>https://www.netutil.app/ja/blog/flush-dns-cache-mac/</link>
      <pubDate>Sat, 16 May 2026 00:00:00 +0000</pubDate>
      <guid>https://www.netutil.app/ja/blog/flush-dns-cache-mac/</guid>
      <description>&lt;p&gt;DNS キャッシュの問題は誤診しやすいです。ドメインのレコードを更新して伝播を待ち、ブラウザを開いても古いサイトがまだ表示される。または以前は動いていたサイトに突然接続できなくなる。サーバーは問題ない。インターネットも問題ない。問題は Mac が古くなった DNS の答えをキャッシュしてまだ提供していることです。&lt;/p&gt;&#xA;&lt;p&gt;DNS キャッシュのフラッシュは macOS に保存された答えを忘れて最初からやり直すよう指示します。コマンド一つで約 5 秒かかります。&lt;/p&gt;&#xA;&lt;h2 id=&#34;mac-が-dns-レコードをキャッシュする理由&#34;&gt;Mac が DNS レコードをキャッシュする理由&lt;/h2&gt;&#xA;&lt;p&gt;ウェブサイトにアクセスするたびに、Mac はドメイン名（&lt;code&gt;example.com&lt;/code&gt; など）を IP アドレスに変換しなければなりません。この変換にはプロセスがあります：Mac はまずローカル DNS キャッシュを確認し、次に DNS リゾルバー（通常は ISP のものか 1.1.1.1 などの公共リゾルバー）に問い合わせ、どちらにも答えがない場合、リゾルバーがそのドメインの権威ネームサーバーに問い合わせます。&lt;/p&gt;&#xA;&lt;figure class=&#34;blog-svg&#34; role=&#34;img&#34; aria-labelledby=&#34;dns-flow-title dns-flow-desc&#34;&gt;&#xA;  &lt;svg viewBox=&#34;0 0 720 180&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&#xA;       style=&#34;max-width: 100%; height: auto;&#34;&gt;&#xA;    &lt;title id=&#34;dns-flow-title&#34;&gt;DNS resolution flow on macOS&lt;/title&gt;&#xA;    &lt;desc id=&#34;dns-flow-desc&#34;&gt;A four-step diagram showing DNS resolution: Mac checks local cache, then queries DNS resolver, then resolver contacts authoritative server, then IP address is returned to the Mac.&lt;/desc&gt;&#xA;    &lt;style&gt;&#xA;      .dns-label { font-family: -apple-system, system-ui, sans-serif; font-size: 13px; fill: #1d1d1f; text-anchor: middle; }&#xA;      .dns-sublabel { font-family: -apple-system, system-ui, sans-serif; font-size: 11px; fill: #6e6e73; text-anchor: middle; }&#xA;      .dns-box { fill: #F5F5F7; stroke: #D2D2D7; stroke-width: 1.5; }&#xA;      .dns-box-highlight { fill: #E8F4FF; stroke: #007AFF; stroke-width: 1.5; }&#xA;      .dns-arrow { stroke: #8E8E93; stroke-width: 2; fill: none; marker-end: url(#dns-arrow-head); }&#xA;      .dns-return { stroke: #34C759; stroke-width: 1.5; fill: none; stroke-dasharray: 5,3; marker-end: url(#dns-arrow-green); }&#xA;      @media (prefers-color-scheme: dark) {&#xA;        .dns-label { fill: #F5F5F7; }&#xA;        .dns-sublabel { fill: #98989D; }&#xA;        .dns-box { fill: #2C2C2E; stroke: #48484A; }&#xA;        .dns-box-highlight { fill: #1C3A5E; stroke: #0A84FF; }&#xA;      }&#xA;      @media (prefers-reduced-motion: reduce) {&#xA;        .dns-animated { animation: none !important; }&#xA;      }&#xA;      @keyframes fadeIn {&#xA;        from { opacity: 0; transform: translateY(4px); }&#xA;        to { opacity: 1; transform: translateY(0); }&#xA;      }&#xA;      .dns-step1 { animation: fadeIn 0.4s ease-out 0.1s both; }&#xA;      .dns-step2 { animation: fadeIn 0.4s ease-out 0.5s both; }&#xA;      .dns-step3 { animation: fadeIn 0.4s ease-out 0.9s both; }&#xA;      .dns-step4 { animation: fadeIn 0.4s ease-out 1.3s both; }&#xA;      .dns-return-line { animation: fadeIn 0.4s ease-out 1.7s both; }&#xA;    &lt;/style&gt;&#xA;    &lt;defs&gt;&#xA;      &lt;marker id=&#34;dns-arrow-head&#34; markerWidth=&#34;9&#34; markerHeight=&#34;7&#34; refX=&#34;9&#34; refY=&#34;3.5&#34; orient=&#34;auto&#34;&gt;&#xA;        &lt;polygon points=&#34;0 0, 9 3.5, 0 7&#34; fill=&#34;#8E8E93&#34; /&gt;&#xA;      &lt;/marker&gt;&#xA;      &lt;marker id=&#34;dns-arrow-green&#34; markerWidth=&#34;9&#34; markerHeight=&#34;7&#34; refX=&#34;9&#34; refY=&#34;3.5&#34; orient=&#34;auto&#34;&gt;&#xA;        &lt;polygon points=&#34;0 0, 9 3.5, 0 7&#34; fill=&#34;#34C759&#34; /&gt;&#xA;      &lt;/marker&gt;&#xA;    &lt;/defs&gt;&#xA;    &lt;!-- Box 1: Mac --&gt;&#xA;    &lt;g class=&#34;dns-step1&#34;&gt;&#xA;      &lt;rect x=&#34;20&#34; y=&#34;50&#34; width=&#34;120&#34; height=&#34;70&#34; rx=&#34;10&#34; class=&#34;dns-box-highlight&#34; /&gt;&#xA;      &lt;text x=&#34;80&#34; y=&#34;82&#34; class=&#34;dns-label&#34; font-weight=&#34;600&#34;&gt;Your Mac&lt;/text&gt;&#xA;      &lt;text x=&#34;80&#34; y=&#34;99&#34; class=&#34;dns-sublabel&#34;&gt;local DNS cache&lt;/text&gt;&#xA;    &lt;/g&gt;&#xA;    &lt;!-- Arrow 1→2 --&gt;&#xA;    &lt;g class=&#34;dns-step2&#34;&gt;&#xA;      &lt;line x1=&#34;141&#34; y1=&#34;85&#34; x2=&#34;189&#34; y2=&#34;85&#34; class=&#34;dns-arrow&#34; /&gt;&#xA;    &lt;/g&gt;&#xA;    &lt;!-- Box 2: DNS Resolver --&gt;&#xA;    &lt;g class=&#34;dns-step2&#34;&gt;&#xA;      &lt;rect x=&#34;190&#34; y=&#34;50&#34; width=&#34;140&#34; height=&#34;70&#34; rx=&#34;10&#34; class=&#34;dns-box&#34; /&gt;&#xA;      &lt;text x=&#34;260&#34; y=&#34;82&#34; class=&#34;dns-label&#34; font-weight=&#34;600&#34;&gt;DNS Resolver&lt;/text&gt;&#xA;      &lt;text x=&#34;260&#34; y=&#34;99&#34; class=&#34;dns-sublabel&#34;&gt;1.1.1.1 or ISP&lt;/text&gt;&#xA;    &lt;/g&gt;&#xA;    &lt;!-- Arrow 2→3 --&gt;&#xA;    &lt;g class=&#34;dns-step3&#34;&gt;&#xA;      &lt;line x1=&#34;331&#34; y1=&#34;85&#34; x2=&#34;379&#34; y2=&#34;85&#34; class=&#34;dns-arrow&#34; /&gt;&#xA;    &lt;/g&gt;&#xA;    &lt;!-- Box 3: Authoritative NS --&gt;&#xA;    &lt;g class=&#34;dns-step3&#34;&gt;&#xA;      &lt;rect x=&#34;380&#34; y=&#34;50&#34; width=&#34;150&#34; height=&#34;70&#34; rx=&#34;10&#34; class=&#34;dns-box&#34; /&gt;&#xA;      &lt;text x=&#34;455&#34; y=&#34;82&#34; class=&#34;dns-label&#34; font-weight=&#34;600&#34;&gt;Authoritative NS&lt;/text&gt;&#xA;      &lt;text x=&#34;455&#34; y=&#34;99&#34; class=&#34;dns-sublabel&#34;&gt;holds real records&lt;/text&gt;&#xA;    &lt;/g&gt;&#xA;    &lt;!-- Arrow 3→4 (IP back) --&gt;&#xA;    &lt;g class=&#34;dns-step4&#34;&gt;&#xA;      &lt;line x1=&#34;531&#34; y1=&#34;85&#34; x2=&#34;579&#34; y2=&#34;85&#34; class=&#34;dns-arrow&#34; /&gt;&#xA;    &lt;/g&gt;&#xA;    &lt;!-- Box 4: IP result --&gt;&#xA;    &lt;g class=&#34;dns-step4&#34;&gt;&#xA;      &lt;rect x=&#34;580&#34; y=&#34;50&#34; width=&#34;120&#34; height=&#34;70&#34; rx=&#34;10&#34; class=&#34;dns-box&#34; /&gt;&#xA;      &lt;text x=&#34;640&#34; y=&#34;82&#34; class=&#34;dns-label&#34; font-weight=&#34;600&#34;&gt;IP Address&lt;/text&gt;&#xA;      &lt;text x=&#34;640&#34; y=&#34;99&#34; class=&#34;dns-sublabel&#34;&gt;returned to Mac&lt;/text&gt;&#xA;    &lt;/g&gt;&#xA;    &lt;!-- Return path (dashed green) --&gt;&#xA;    &lt;g class=&#34;dns-return-line&#34;&gt;&#xA;      &lt;path d=&#34;M 640 120 Q 640 155 360 155 Q 80 155 80 121&#34; class=&#34;dns-return&#34; /&gt;&#xA;      &lt;text x=&#34;360&#34; y=&#34;170&#34; class=&#34;dns-sublabel&#34; fill=&#34;#34C759&#34;&gt;cached for future lookups&lt;/text&gt;&#xA;    &lt;/g&gt;&#xA;  &lt;/svg&gt;&#xA;  &lt;figcaption&gt;macOS は最近訪問したサイトのこのチェーンをスキップするために DNS の答えをローカルにキャッシュします。レコードが変更されると、そのキャッシュが古いデータを提供することがあります。&lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;キャッシュは通常良いことです。最近訪問したサイトのルックアップチェーン全体をスキップできるため、ブラウジングが速くなります。問題は DNS レコードが変更されて Mac のキャッシュした答えがまだ古い宛先を指している場合に発生します。DNS レコードの TTL（time to live）はリゾルバーにどのくらいキャッシュするかを指示しますが、macOS は常にそれを正確に守るわけではありません。&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
