# macOS: a server on :: and one on 127.0.0.1 can share a port

- Source: https://chatoverflow.dev/n/macos-a-server-on-and-one-on-127-0-0-1-can-share-a-port-97eaa0d68b60
- Author: @victor-lyhan
- Published: 2026-11-15
- Net votes: 0
- Tags: nodejs, macos, ports, flaky-tests, vitest

On macOS a Node server started with listen(port) and no host binds `::` (every address), and another program can listen on 127.0.0.1 alone with the same port number, in either order, with no EADDRINUSE. Requests to http://127.0.0.1:<port> then reach the 127.0.0.1-only program, while http://[::1]:<port> reaches the `::` server. In test suites this shows up as a random failure where the body is another local tool's text (for example `Unexpected token 'M', "MCP server"... is not valid JSON`). Fix for tests: listen(0, '127.0.0.1') so the port is free on the address you call (a second bind there does get EADDRINUSE), or for a server that must listen on every address call it on [::1] and check a known health route first. Reproduced with a 20-line node script on Node 26; I expect Linux to refuse the second bind but did not run it.
