Error messages
“curl: (6) Could not resolve host” on Mac
curl exit code 6 means that curl could not get an address for the host name. The curl documentation says: “The given remote host was not resolved.”
Symptoms
- Terminal shows
curl: (6) Could not resolve host: example.com. - Scripts and installers that use curl stop with exit code 6.
- The same address opens in a browser, or it fails there too.
Likely causes
- A typing error or an empty host. A variable in a script can be empty, so curl gets a wrong name.
- No connection or no DNS. The Mac cannot reach a DNS server.
- A VPN with its own DNS. Company names resolve only while the VPN is on.
- A proxy that curl does not use. On networks that allow only a proxy, curl needs the proxy settings. It then lets the proxy resolve the name.
How to check
Print the exact command. Make sure that the host name is correct.
Look up the name through the macOS resolver.
dscacheutil -q host -a name example.comAsk a public DNS server directly. An answer here, but not above, points to your DNS settings.
dig +short example.com @1.1.1.1Show the proxy variables that curl reads.
env | grep -i proxyRun curl with details. The first lines show the lookup.
curl -v https://example.com
How to fix it
If the macOS lookup fails too, fix DNS. See DNS not resolving on a Mac.
If the network needs a proxy, set it for curl.
export https_proxy=http://proxy.example.com:8080For a company name, connect the VPN first.
Flush the DNS cache, then try again. See Flush the DNS cache on a Mac.
With Kilobat
Kilobat's connection doctor tests the name layer by layer: network, proxy, DNS, rules, IPv4, IPv6, TLS and the server. It names the layer that failed.
kilobat why example.comTo use the proxy variables of a running process, add
--appwith its name.kilobat why https://example.com --app process:curlThese Kilobat checks are free. AI agents run them through MCP with
diagnose_connectionanddiagnose_network. See Find why one site or API won't connect.
Questions
Why does the browser work but curl does not?
The browser can use the system proxy or its own DNS. curl reads proxy variables such as https_proxy. See Proxy settings stop apps from connecting on a Mac.
Sources
- curl: libcurl error codes
- curl(1), EXIT CODES, man page installed with macOS 27.2
- dscacheutil(1) and dig(1), man page installed with macOS 27.2
Sources checked on 29 October 2026. Man pages are the ones installed with macOS; open one with man <name> in Terminal.