curl -v -o /dev/null https://example.comShow the full conversation, discard the body.
When to use it
Use curl -v when a request fails or behaves oddly: wrong redirect, TLS error, unexpected status code, missing header. It's also the quickest way to see which IP and protocol a client really used.
Steps
Run a verbose request
-v prints the conversation to stderr; -o /dev/null throws away the body so it doesn't flood the terminal.curl -v -o /dev/null https://example.comSee only the headers
-I sends a HEAD request and prints response headers. Some servers answer HEAD differently; use -sD - -o /dev/null for a GET's headers.curl -sD - -o /dev/null https://example.comTime each phase
-w prints timing variables after the request: DNS, TCP connect, TLS, first byte and total.curl -s -o /dev/null -w '%{time_namelookup} %{time_connect} %{time_appconnect} %{time_starttransfer} %{time_total}\n' https://example.comGo deeper
--trace-ascii writes every byte sent and received to a file.curl --trace-ascii trace.txt https://example.com
Output explained
Real curl -v output from macOS 15 (shortened):
* Host example.com:443 was resolved.
* IPv6: 2606:4700:10::ac42:93f3, 2606:4700:10::6814:179a
* IPv4: 172.66.147.243, 104.20.23.154
* Trying [2606:4700:10::ac42:93f3]:443...
* Connected to example.com (2606:4700:10::ac42:93f3) port 443
* ALPN: curl offers h2,http/1.1
* SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256
* ALPN: server accepted h2
* Server certificate:
* subject: CN=example.com
* issuer: C=US; O=SSL Corporation; CN=Cloudflare TLS Issuing ECC CA 3
> GET / HTTP/2
> Host: example.com
> User-Agent: curl/8.7.1
< HTTP/2 200
< content-type: text/html
- Lines with
*are curl's notes: resolution, the address it tried, TLS details and certificate. >lines are the request headers curl sent;<lines the response.- ALPN shows the negotiated protocol (here HTTP/2).
- curl tried IPv6 first because the name has AAAA records and the Mac has IPv6.
The timing line dns:0.0023 connect:0.0713 tls:0.1454 ttfb:0.2129 total:0.2131 is cumulative: DNS took 2 ms, TCP connect ~69 ms more, TLS ~74 ms more, and the server took ~67 ms after that to send the first byte.
Options and variations
| Flag | Meaning | Example |
|---|---|---|
| -v | Verbose: connection, TLS and headers | curl -v https://example.com |
| -I | HEAD request, show response headers | curl -I https://example.com |
| -L | Follow redirects | curl -vL http://example.com |
| -w FORMAT | Print variables after the transfer | curl -w '%{http_code}\n' -o /dev/null -s URL |
| --resolve HOST:PORT:IP | Force an address, bypassing DNS | curl --resolve example.com:443:203.0.113.10 https://example.com |
| -4 / -6 | Use only IPv4 / IPv6 | curl -4 -v https://example.com |
| --http1.1 / --http2 | Force an HTTP version | curl --http1.1 -v https://example.com |
Common errors
| Error | Cause | Fix |
|---|---|---|
| curl: (6) Could not resolve host | DNS failed | Check the name, DNS and proxy variables. |
| curl: (7) Failed to connect … Connection refused | Nothing listening on that port | Check the port and that the server runs. |
| curl: (60) SSL certificate problem | Certificate not trusted | See the “unable to get local issuer certificate” guide; don't use -k in production. |
| curl: (28) Operation timed out | No response in time | Check reachability with nc -vz host port; raise --max-time if the server is just slow. |
Do it in the app
LightAtom's connections view shows curl's connection to the server, which address family it used and how many bytes moved.
Frequently asked questions
What does curl -v do?
It prints details of the whole transfer: name resolution, the address it connects to, the TLS handshake and certificate, and every request and response header.
How do I measure response time with curl?
Use -w with timing variables: time_namelookup, time_connect, time_appconnect (TLS), time_starttransfer (first byte) and time_total. Each is seconds since the start.
Why does curl -v print to the terminal even with -o?
Verbose output goes to stderr, while -o only redirects the body. Redirect stderr with 2>file to save the verbose output.