When you download files from certain apps like Safari and Chrome on your Mac, those files are tagged with the “Where from” metadata attribute. Depending on where the file was downloaded from, this attribute may refer to the host’s URL, a sender’s email address, or another piece of identifying information. While not obvious, you can delete or even change this attribute.
To see if a file on your Mac has the “Where from” attribute, select it in Finder, then either use the Command-I keyboard shortcut to open the info pane or right-click or Control-click it and select “Get Info.” If you don’t see a “Where from” tag in the More Info section, none was saved to the file. If you do see it, it may be the URL for the file’s location online, whether a simple website URL or a long, ugly attachment URL from services like Gmail and Google Drive. It’s up to the app’s developer to incorporate and customize the global kMDItemWhereFroms variable.
If you plan on sharing a photo, video, document, or other file type, you may not want the recipient to know where you got it from. Or, in the case of those long, ugly attachment URLs from services like Gmail and Google Drive, you may want to change the source link to something you or your recipients can reference since the auto-created embedded link will be annoying or useless.
Some apps will wipe the “Where from” and other attributes from files during sharing. Others may retain the information or overwrite it. To be sure the original location is not embedded in the metadata, you can delete it via Terminal.
Deleting Where Froms in Files
Open the Terminal app on macOS, then enter the command below, replacing <file path> with the path to the file. The easiest way is to delete or omit <file path> from the command and then drag and drop the file into Terminal, ensuring there is still a space before your file’s path.
xattr -d com.apple.metadata:kMDItemWhereFroms <file path>
For example:
xattr -d com.apple.metadata:kMDItemWhereFroms /Users/gadgethacks/Downloads/GadgetHacksLogo-WR.png
Here, we’re using xattr, short for extended attributes, your Mac’s built-in command-line tool for managing name:file pairs permanently embedded in a file’s metadata. For the command-line argument, -d is used to delete the information stored in com.apple.metadata:kMDItemWhereFroms for the file.
You can then open up the info pane for the file to verify the attribute is gone.
Changing Where Froms in Files
If you want to change the URL currently assigned to the “Where from” metadata attribute, use the following command in Terminal. This is useful when you want to provide a cleaner URL when sharing an image, video, or other file with somebody. It also helps you stay more organized and recall the source more easily.
Replace <TheURL> with the URL you want to add to the file; it only seems to work with URLs, so you can’t add regular notes here. Then, replace <file path> with the path to the file. Ensure there are still spaces before the new URL and your file’s path.
xattr -w com.apple.metadata:kMDItemWhereFroms <TheURL> <file path>
For example:
xattr -w com.apple.metadata:kMDItemWhereFroms https://gthx.app/z8ypy /Users/gadgethacks/Downloads/GadgetHacksLogo-RW.png
Here, we’re using -w to write over the value of the attribute’s string with whatever URL precedes the file’s location. You can have or omit https:// in front of the URL — it doesn’t matter. If the URL has special characters, you can try to enclose the complete URL within “double quotation marks” so that it doesn’t get confused, but simpler URLs seem to work over complicated ones.
You can then open up the info pane for the file to verify the attribute is gone.
Learning More
If you want to know what else xattr can help you accomplish with other extended metadata attributes, enter the help command into a Terminal window:
xattr --help
Or use this, where “h” stands for help:
xattr -h
Either should spit out a help page with other flags to use:
usage: xattr [-l] [-r] [-s] [-v] [-x] file [file ...]
xattr -p [-l] [-r] [-s] [-v] [-x] attr_name file [file ...]
xattr -w [-r] [-s] [-x] attr_name attr_value file [file ...]
xattr -d [-r] [-s] attr_name file [file ...]
xattr -c [-r] [-s] file [file ...]
The first form lists the names of all xattrs on the given file(s).
The second form (-p) prints the value of the xattr attr_name.
The third form (-w) sets the value of the xattr attr_name to the string attr_value.
The fourth form (-d) deletes the xattr attr_name.
The fifth form (-c) deletes (clears) all xattrs.
options:
-h: print this help
-l: print long format (attr_name: attr_value and hex output has offsets and
ascii representation)
-r: act recursively
-s: act on the symbolic link itself rather than what the link points to
-v: also print filename (automatic with -r and with multiple files)
-x: attr_value is represented as a hex string for input and output
Just updated your iPhone? You’ll find new features for Podcasts, News, Books, and TV, as well as important security improvements and fresh wallpapers. Find out what’s new and changed on your iPhone with the iOS 17.5 update.
“Hey there, just a heads-up: We’re part of the Amazon affiliate program, so when you buy through links on our site, we may earn a small commission. But don’t worry, it doesn’t cost you anything extra and helps us keep the lights on. Thanks for your support!”