Most files you download on a Mac quietly remember where they came from. macOS keeps the source URL and the app that saved the file as metadata, and you can read both in a few seconds once you know where to look.
How do I see where a file was downloaded from on Mac?
It depends on what you need. To check one file, select it in Finder, press Command-I, and look at "Where from" under More Info. To check many files or script it, use mdls or xattr in Terminal. To sort files by source automatically, you need a rules app: Hazel works well if you already own it and want regex or scripts, and AutoShelf works if you also want to match the app that downloaded the file. If you only need this once in a while, Finder is enough and you do not need either app.
What is "Where from" metadata?
When a browser or another app downloads a file, it can write the download address into an extended attribute named com.apple.metadata:kMDItemWhereFroms. Spotlight indexes it as kMDItemWhereFroms, and Finder shows it as "Where from".
It is a list, not a single value. A Safari download usually holds two entries: the direct file URL and the page you were on when you clicked the link. Other apps may write one entry or none.
There is a second, separate attribute called com.apple.quarantine. That one is used by Gatekeeper, and it records the name of the app that downloaded the file. More on that below.
How to check "Where from" in Finder
- Select the file in Finder.
- Press Command-I, or choose File > Get Info.
- Expand the More Info section.
- Read the "Where from" line. You can select the text and copy it.
If there is no "Where from" line, the file has no source URL stored. The section below on missing data explains why.
How to read the download URL in Terminal
The quickest way is mdls, which asks Spotlight for the value:
mdls -name kMDItemWhereFroms ~/Downloads/report.pdf
The output looks like this:
kMDItemWhereFroms = (
"https://example.com/files/report.pdf",
"https://example.com/downloads"
)
If it prints (null), either the attribute is missing or Spotlight has not indexed that location (for example, a folder excluded from Spotlight or some external drives).
To read the attribute directly from the file, without Spotlight, use xattr. The value is stored as a binary property list, so xattr -p on its own prints unreadable bytes. Print it as hex, turn the hex back into bytes, and let plutil decode it:
xattr -px com.apple.metadata:kMDItemWhereFroms ~/Downloads/report.pdf | xxd -r -p | plutil -p -
That prints the same list of URLs. To see which extended attributes a file has at all, list their names:
xattr ~/Downloads/report.pdf
How to see which app downloaded a file
Finder does not show the downloading app. It is stored in the com.apple.quarantine attribute, which you can print as plain text:
xattr -p com.apple.quarantine ~/Downloads/report.pdf
The output is four fields separated by semicolons, something like:
0083;6710a3c2;Safari;8F3C1E2A-4B6D-4C1A-9E2F-1A2B3C4D5E6F
- The first field is a set of flags, in hex.
- The second is the download time as a Unix timestamp, in hex.
- The third is the name of the app that saved the file, such as Safari, Google Chrome, or Slack.
- The fourth is an ID that points to a record in the Quarantine Events database in
~/Library/Preferences, which can also hold the origin URL.
I wrote more about this on the find which app downloaded a file page.
Why is "Where from" missing on some files?
Source data is written by the app that saves the file, not by macOS on its own. So it is missing more often than people expect:
- The app never wrote it. Browsers generally do. Many other apps, command-line tools like
curl, andgit clonedo not. - The file was created locally. Screenshots, exports, and files you saved yourself have no download source.
- The file arrived another way. Files from AirDrop, cloud sync folders, network shares, or a USB drive may carry no URL, or only a quarantine attribute without one.
- It came out of an archive. Files extracted from a zip may not carry the URL of the zip they came from, depending on the tool that extracted them.
- Someone removed it. Running
xattr -corxattr -d com.apple.quarantinestrips attributes, and some cleanup and privacy tools remove them on purpose. - The attributes got lost in a copy. Copying through a tool or file system that does not keep extended attributes drops them.
If you rely on source data for sorting, plan a fallback rule for files that have none, such as sorting by file type.
Can a Finder Smart Folder filter by download source?
Partly. Smart Folders are saved Spotlight searches, and Spotlight does index kMDItemWhereFroms. In the Finder search bar you can add a criterion, choose "Other...", and look for a "Where from" attribute. I have not found Apple documentation confirming how reliably it matches, so treat it as hit and miss.
The same search in Terminal is easier to check:
mdfind -onlyin ~/Downloads 'kMDItemWhereFroms == "*github.com*"'
Two limits apply either way. Results depend on Spotlight indexing the folder, and a Smart Folder only shows files. It never moves, renames, or tags them. For that you need a rules app.
How do I sort files by where they were downloaded from automatically?
Here are the realistic options:
| Option | Matches source URL | Matches downloading app | Moves files | Cost (as of October 2026) |
|---|---|---|---|---|
| Finder Get Info | Shows it | No | No | Free |
Smart Folder / mdfind |
Search only | No | No | Free |
| Hazel | Yes, via Source URL | No | Yes | $42 |
| AutoShelf | Yes | Yes | Yes | Free with 1 rule, $19.99 one-time |
Hazel has a Source URL/Address attribute you can use as a rule condition (as of October 2026), and it has supported pattern matching on it for many versions. It only works when the downloading app saved the URL, the same limit described above. If you need regex, AppleScript, or shell script actions, Hazel is the stronger choice. My Hazel comparison goes into the details.
AutoShelf is the menu bar app I build. It reads the same kMDItemWhereFroms data for a "Download Source (URL)" condition and reads the downloading app for a separate download app condition, so you can route Safari downloads one way and Chrome downloads another. URL conditions accept wildcards, so *github.com* or yourcompany.slack.com both work. AutoShelf is free with 1 rule, or $19.99 one-time for unlimited rules, and needs macOS 14 Sonoma or later.
How to set up source-based sorting in AutoShelf
- Install AutoShelf from the Mac App Store.
- Open Templates and pick Sort by Source. It sends GitHub downloads to a Developer folder and Slack downloads to a Work folder based on their download URL. All templates are free.
- To add your own source, create a new rule, set the watch folder to Downloads, and choose the "Download Source (URL)" condition.
- Enter the URL or pattern to match, for example
*figma.com*. - Choose an action, such as move or copy to a folder, and pick the destination.
- Optionally add a second condition, like file type, so only
.zipfiles from GitHub get moved.
Files without any source data are not touched by source-based rules, so add a type-based rule as a catch-all. There is more on this on the sort files by download source page. If you prefer the terminal, the same rules can be created with the CLI or through an AI assistant using the MCP setup.
If you are curious how the app reads these attributes in Swift, I wrote about it in designing a rule engine from scratch.
Frequently asked questions
Is "Where from" the same as the quarantine attribute?
No. "Where from" (kMDItemWhereFroms) stores the source URLs. com.apple.quarantine stores flags, a timestamp, and the name of the downloading app, and Gatekeeper uses it to warn you before opening downloaded apps.
How do I remove the "Where from" information from a file?
Run xattr -d com.apple.metadata:kMDItemWhereFroms <file> in Terminal. Finder's Get Info window may keep showing the old value until you reopen it or relaunch Finder.
Why does mdls show (null) when Get Info shows a URL?
mdls reads from the Spotlight index, so it can be empty if the folder is not indexed yet or is excluded from Spotlight. The xattr command reads the file directly and does not depend on indexing.
Can I sort files by the browser that downloaded them?
Not with Finder or Hazel. AutoShelf has a download app condition that reads the app name from the quarantine data, so Safari, Chrome, and Arc downloads can each go to their own folder.
Does every downloaded file have a "Where from" URL?
No. It depends on the app that saved the file. Browsers usually write it, while many other apps, command-line tools, AirDrop, and archive extraction may leave it out.