Skip to content
Home » How to Use rsync on macOS: Examples and Common Flags

How to Use rsync on macOS: Examples and Common Flags

rsync copies and syncs folders efficiently — it only transfers the parts that changed, which makes it ideal for backups and for keeping two machines in step. It’s built into macOS, so there’s nothing to install for everyday use. This walks through the commands you’ll actually reach for — copy, mirror, exclude, sync over SSH, and previewing a run — and ends with a reference of the common flags. Every command below was checked on macOS 26.5.2.

It’s already installed

macOS ships rsync at /usr/bin/rsync, so you can use it right away. Confirm it’s there with:

$ rsync --version
openrsync: protocol version 29
rsync version 2.6.9 compatible

The built-in tool is openrsync, Apple’s BSD-licensed rewrite; the “2.6.9 compatible” line refers to the network protocol, not the age of the software. It handles everything in this guide. The one time you’d want more is if a script needs a GNU rsync 3.x–only option — then install the GNU version with Homebrew, which sits alongside the built-in one:

brew install rsync

Copy a folder

The everyday form is rsync -av source/ destination/. The -a (archive) flag recurses into subfolders and preserves permissions, timestamps, and symlinks; -v lists what’s transferred:

rsync -av ~/Documents/project/ ~/Backups/project/

The trailing slash on the source matters: project/ copies the contents of the folder into the destination, while project (no slash) copies the folder itself, creating ~/Backups/project/project/. Run it again later and only changed files move.

Mirror a folder

To make the destination an exact copy — including deleting files there that no longer exist in the source — add --delete:

rsync -av --delete ~/Documents/project/ /Volumes/Backup/project/

Because --delete removes files, it’s the one to run as a dry run first (below) so you can see exactly what would go before it goes.

Exclude files

--exclude skips anything matching a pattern, and you can repeat it:

rsync -av --exclude='*.log' --exclude='node_modules' src/ dst/

For a longer list, keep the patterns in a file — one per line — and point at it with --exclude-from:

rsync -av --exclude-from=exclude.txt src/ dst/

Sync over SSH

Give rsync a remote path in user@host:path form and it transfers over SSH automatically. Add -z to compress the data on the way, which helps over a network:

rsync -avz ~/Documents/project/ user@host:~/project/

That pushes your local folder to the remote machine; swap the two paths to pull the other way. For a Mac-to-Mac copy where you want to keep macOS metadata like resource forks and extended attributes, add -E.

Preview with a dry run

Add -n (dry run) to any command and rsync shows exactly what it would do without changing a thing — the safety check before a --delete in particular:

rsync -avn --delete ~/Documents/project/ /Volumes/Backup/project/

Read the list it prints, confirm nothing surprising is about to be removed, then run the same command again without the -n.

Common flags

The options you’ll use most, all supported by the built-in rsync:

FlagWhat it does
-aArchive: recurse and preserve permissions, times, and symlinks
-vVerbose — list the files transferred (-vv for more detail)
-zCompress data during transfer (worthwhile over SSH)
-PShow progress and resume partially transferred files
-nDry run — show what would happen, change nothing
--deleteRemove files in the destination that aren’t in the source
--exclude 'PATTERN'Skip matching files; repeatable, or use --exclude-from=FILE
-EPreserve macOS extended attributes and resource forks
-e sshUse SSH as the transport (already the default for remote paths)

That’s the core of it: -av to copy, --delete to mirror, --exclude to skip, a remote path for SSH, and -n to preview first. If you ever hit an “unrecognized option,” it’s likely a GNU rsync 3.x flag such as --info=progress2 — reach for brew install rsync in that case. All checked on macOS 26.5.2.

Leave a Reply

Your email address will not be published. Required fields are marked *