Using rsync on Mac to Copy Files

There’s a lack of good file copy utilities on Mac like there is for Windows (eg. Teracopy/Ultracopy). If I need to copy a bunch of files where I’m likely to come across errors copying, I’ll use rsync!

This guide covers how to copy files on a Mac using an external drive or any connected network drive. It’ll skip any errors and log all the failed copies to a file for you to check through. It’s especially handy for copying files while skipping errors, corrupted files and getting past some permissions errors.

This is a beginner to intermediate guide and doesn’t cover some of the more advanced features of rsync.

Step by Step rsync for Beginners

Step 1:  Open Terminal.app    It is located in Applications/Utilities/
You can also open it the quick way by going to Spotlight and typing: terminal

Step 2: Type the following into Terminal, but do not press Enter. (note there is a space at the end of the command and the P is a capital letter)

rsync -ahP

Step 3: Drag and drop the SOURCE folder onto the Terminal window. This is the folder that has the items you want to copy.

Step 4: Drag and drop the DESTINATION folder onto the Terminal window. This is the folder you want the files to go to.

Step 5: Add the following to the end of the command (note the space after the destination folder):

2> ~/Desktop/rSyncErrors.txt

Step 6: Press Enter!
You will see the files transferring as they go, if there’s a lot of files it’ll fly by pretty quickly. Just wait until it has finished.

At the end you will see a summary of how much has copied and how fast it went.

Checking for Errors

To Check for Errors, there is a file on your Desktop called rSyncErrors.txt, this will contain any errors during the copy and why they failed to copy.

What does the command mean?

rsync is a really powerful program that can do a whole lot of stuff, the command I wrote above is a very simple one designed to copy data quickly and easily without too much fuss.

Here’s a run down on the different parts of the command:

rsync -ahP {source} {destination} 2> ~/Desktop/rsyncErrors.txt

rsync   — Runs the rsync command

-ahP        — These are called Switches. They tell the program to run with particular options.

a  – This tells it to archive, it will preserve permissions, modified/created dates and any other extra data with the file.

h  – Human Readable. This tells it to display all the values in human readable form (instead of “112543662.08 bytes”, it will show “107.33MB”)

P  – Progress/Partial – This is actually 2 commands in one. Progress will show you the progress of each file as it transfers (so you can see that it’s actually copying data). Partial will resume files that have been inturrupted part way through copying.

2> ~/Desktop/rsyncErrors.txt   – This tells it to send any errors to the file on your desktop called rsyncErrors.txt.

Extra Tips

If you want to cancel an rsync part way through running, you can press Control-C to stop it. It won’t undo anything that has been done though, so you’ll end up with only part of the data copied.

rsync can resume from a failed copy. For example, if you’ve got a hard drive that tends to disconnect randomly, you can redo the command and it will resume from where it left off.

If you’re having trouble with permissions and copying files, you can run the command as sudo (type “sudo ” before the command). This will run it as an Administrator. Though with the settings I’ve specified, it’ll just copy the permissions errors along with it!

Advanced Version

(Skip this if you’re not sure what you’re doing!)
The terminal command to use rsync to copy files is:

rsync -ahP {source} {destination} 2> ~/Desktop/rsyncErrors.txt

Did this work well for you? Any problems?  Please leave a comment below!

9 comments

This worked out great. thank you

I want to thank you for this tutorial! I have an external drive that belonged to my PC when it failed. I have 40,000+ items on it, and finally got an enclosure that allowed the Mac to read the data. I bought an 8TB external and was trying to move everything over for safe keeping.
However, I kept getting those still in use errors. I have been putting it off for over a year because it’s such a pain to go 30 at a time, then skip the errors. I was going to give up until I saw your post.

I have one BIG issue though. Though I am going from one external drive to another, the system seems to want to go through the Mac, and I do not have enough space to handle it, therefore it stops and says there’s not enough room. Why is this? Why can’t it just push all data (skipping over the errors) from one external to another? I have plenty of room on the destination drive. Thank you again for all your help

This is the error

rsync: writefd_unbuffered failed to write 32768 bytes [sender]: Broken pipe (32)
WARNING: Media444/El Jason 2.jpg failed verification — update retained (will try again).
rsync: connection unexpectedly closed (88872 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-51/rsync/io.c(453) [sender=2.6.9]
Chriss-MacBook-Pro:~ chrisyakubovsky$

Hey dude, thanks for reading my blog!
It shouldn’t go through your computer as such, it should just go from one drive to the other. The error you’re getting looks like the drive is dropping out.
The plus side is, just keep running that rsync command (hit up on the keyboard to go to the last command you ran, then enter) and it’ll resume from where it was.

Hope this helps!

Ducky

Hello, than you for the excellent tutorial. Data created is not kept.
I sync MBA Early 2017 with Toshiba Canvio T1, exFat format.

Thank you for your support in advance.

Best, A.

I’m not even sure what you mean by that, did you see any progress as it copied?

duck, thank you for your reply. Yes, the files copy over nicely. File Modified Date and Last Date are kept when files are copied to target folder. The file Created Date changes to Today’s date.
I hope this answers you question.

Any advice?

Best, A.

Ah, yeah I’m not sure about that one, using the -a flag keeps all the date modified etc, but there’s no option for keeping the date created…

I did a bit of googling around and there’s no super easy answer to it that I could see 😐

duck, thank you. I did a bit of googling around myself and found very little. I chosen OS X Extended (Journaled) to format the external drive and ran the rsync -a command. Files are copied over nicely and Created Date, Modified Date and Last Accessed Date are kept.
I thought you would want to know that.
Best, A.

Leave a Reply