MainspringGuides › curl downloads
macOS Guide

Download Files From Terminal With curl on Mac

Updated July 2026 · 3 min read

Every Mac ships with curl, a downloader that fetches anything a browser can — installers, datasets, single files off a server — without opening one. The catch is that curl's defaults surprise beginners: it prints files to the screen unless told otherwise, and it doesn't follow redirects unless asked. Four flags fix all of it.

The two saving flags: -O and -o

# save with the file's own name (capital O)
curl -O https://example.com/files/dataset.zip

# save under a name you choose (lowercase o)
curl -o data.zip https://example.com/files/dataset.zip

Without either flag, curl streams the response to your Terminal window — fine for text, chaos for a ZIP. -O keeps the server's filename (here dataset.zip, saved into your current folder); -o lets you pick the name and path. Undo is as ordinary as it sounds: delete the downloaded file. Several files go in one command by repeating the flag: curl -O url1 -O url2.

-L: the flag everyone forgets

# follow redirects to the real file
curl -LO https://github.com/user/tool/releases/latest/download/tool.zip

Modern download links rarely point at the file itself — they redirect, sometimes twice, to a CDN. By default curl stops at the first redirect and saves the tiny HTML page saying "moved" — the classic symptom is a 300-byte "zip" that won't open. -L tells curl to follow the chain to the real destination. GitHub releases, download shorteners, and most software mirrors all need it; there's no downside to including it habitually.

Resume big downloads with -C -

# start a large download
curl -LO https://example.com/big/image.iso

# connection dropped? resume where it stopped
curl -L -C - -O https://example.com/big/image.iso

-C - (the trailing dash means "work out the offset yourself") checks the partial file on disk and asks the server for only the missing bytes. On a multi-gigabyte download over hotel Wi-Fi, this flag is the difference between an evening and a minute. It requires the server to support ranged requests — nearly all file hosts do.

Seeing what's happening

One macOS-specific note worth knowing: files downloaded with curl don't get the quarantine flag browsers apply, so Gatekeeper's "downloaded from the internet" check doesn't trigger on them. That's convenient for data files — and a reason to download apps only from sources you trust, since you're waiving a safety net.

A complete real-world example

# fetch a release, resumable, quietly, to Downloads
curl -L -C - -o ~/Downloads/tool.zip \
  https://github.com/user/tool/releases/latest/download/tool.zip

Redirects followed, resumable if interrupted, saved where downloads belong. That one shape covers ninety percent of real curl use.

Polite and patient variants

# cap the speed so a background download doesn't hog the line
curl -L --limit-rate 2M -O https://example.com/big/dataset.zip

# give up cleanly if the server hangs
curl -L --max-time 300 -O https://example.com/files/report.pdf

--limit-rate takes values like 500k or 2M and keeps a big download from strangling your video call. --max-time puts a ceiling in seconds on the whole transfer — in scripts, that's the difference between a job that fails visibly and one that hangs forever. Both combine freely with -C -, so a rate-limited, resumable overnight fetch is still one line. And when a transfer misbehaves, add -v once: the verbose trace prints every redirect and header, which usually names the culprit immediately.

Fetch less, flip more

Mainspring is a one-file download that unlocks 90+ hidden macOS settings as labelled, reversible toggles — signed, notarized, and exactly what it says it is.

Try Mainspring free →

Signed & notarized by Apple · 1-day free trial · $29 once

What downloads next

If what you're fetching is software, the better long-term move is a package manager that handles versions and updates for you — see our guide to installing Homebrew.