title: localhost:5000 unavailable in macOS v12 (Monterey)
body: <p>I cannot access a web server on localhost port 5000 on <a href="https://en.wikipedia.org/wiki/MacOS_Monterey" rel="noreferrer">macOS v12</a> (Monterey) (<a href="https://en.wikipedia.org/wiki/Flask_%28web_framework%29" rel="noreferrer">Flask</a> or any other).</p>
  <p>E.g., use the built-in HTTP server, I cannot get onto port 5000:</p>
  <pre class="lang-none prettyprint-override"><code>python3 -m http.server 5000
  
  ... (stack trace)
  File &quot;/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py&quot;, line 466, in server_bind
  self.socket.bind(self.server_address)
  OSError: [Errno 48] Address already in use
  </code></pre>
  <p>If you have Flask installed and you run the Flask web server, <em>it does not fail on start</em>. Let's take the minimum Flask example code:</p>
  <pre><code># Save as hello.py in the current working directory.
  from flask import Flask
  app = Flask(__name__)
  @app.route(&quot;/&quot;)
  def hello_world():
      return &quot;&lt;p&gt;Hello, World!&lt;/p&gt;&quot;
  </code></pre>
  <p>Then run it (provided you have Flask/Python 3 installed):</p>
  <pre class="lang-none prettyprint-override"><code>export FLASK_APP=hello
  flask run
  </code></pre>
  <p>Output:</p>
  <pre class="lang-none prettyprint-override"><code>* Running on http://127.0.0.1:5000/
  </code></pre>
  <p>However, if you try to access this server (from a browser or with anything else), it is denied:</p>
  <pre class="lang-none prettyprint-override"><code>curl -I localhost:5000
  HTTP/1.1 403 Forbidden
  Content-Length: 0
  Server: AirTunes/595.13.1
  </code></pre>