Email WhatsApp
WeChat
WeChat QR

Table of Contents

How to Use rsync Over SSH

Run rsync over SSH to send a project directory from your Mac to a KiwiPi, then rerun the command when the files change. Files found only at the destination remain there unless you explicitly request deletion.

Our article on copying files with SCP covered one-off transfers. Here, the example is a camera-app directory that you edit on the Mac and copy to the board repeatedly. Replace alex and 192.168.1.50 with your Linux account and KiwiPi address.

Run the commands in Terminal on the Mac. You don’t log into Linux first and then try to reach back into the Mac’s home directory. The path beginning with $HOME belongs to the computer running rsync.

rsync Over SSH: Copy Files From Mac to Linux

Prepare the Mac and KiwiPi

Start with a working SSH login; our Mac to Linux SSH guide covers that setup. These commands install rsync on an Ubuntu-based KiwiPi and create a destination owned by the account you’re using:

Bash

ssh -t alex@192.168.1.50 'sudo apt update && sudo apt install rsync'
 ssh alex@192.168.1.50 'mkdir -p /home/alex/projects/camera-app'

rsync needs an executable on both machines. The local copy starts the remote copy through SSH, so there’s no separate rsync daemon to configure for this example.

On the Mac, check command -v rsync and rsync –version. The bundled implementation varies with macOS. For the examples below, use a current upstream rsync from Homebrew. If Homebrew is already installed:

Bash

brew install rsync

Open a new Terminal and check the path and version again. The command should resolve to Homebrew’s rsync, with a 3.x version. If it still finds the system copy, fix your Homebrew shell setup before continuing. The Homebrew rsync package page lists the installation command.

Copy and update the project

With camera-app already present under Projects on the Mac, send its contents:

Bash

rsync -rtv -e ssh "$HOME/Projects/camera-app/" \
   alex@192.168.1.50:/home/alex/projects/camera-app/

Enter your SSH password if you don’t use a key. The files go into /home/alex/projects/camera-app/ on the board. Edit a source file and run the command again; rsync checks the destination and transfers files that need updating.

By default, that check uses file size and modification time. It isn’t a byte-for-byte audit of everything already on the board. The official rsync manual documents the selection rules and the additional checksum option, -c, when you need content-based checking.

The options in this example do fairly specific jobs:

Option What it does here
-r Walks through directories recursively
-t Preserves modification times
-v Prints transfer details
-e ssh Uses SSH as the remote transport
-n Previews without changing destination files
-i Lists the planned or completed changes

What the source slash changes

The slash after camera-app/ matters. Because the destination directory already exists, these source paths produce different layouts:

Source on the Mac Result inside the existing destination
camera-app/ The project’s contents go directly into the destination
camera-app An additional camera-app directory appears inside it

Without the source slash, rsync adds another camera-app directory beneath the destination. That’s how you end up editing one copy and wondering why the application still runs the old one. These source paths are alternatives, not consecutive installation steps.

Keep the source slash when you want the contents, and create the destination explicitly. You can also inspect the planned changes first:

Bash

rsync -rtvni -e ssh "$HOME/Projects/camera-app/" \
   alex@192.168.1.50:/home/alex/projects/camera-app/

Copy files back to the Mac

To download the board’s project into a separate directory on the Mac, swap the source and destination:

Bash

mkdir -p "$HOME/Downloads/kiwipi-project"
 rsync -rtv -e ssh \
   alex@192.168.1.50:/home/alex/projects/camera-app/ \
   "$HOME/Downloads/kiwipi-project/"

This still runs on the Mac. If Linux reports Permission denied, check whether alex can read the source or write the destination involved. Our Linux file permissions guide covers ownership and access; adding local sudo doesn’t grant the remote account extra rights.

Interrupted transfers and exclusions

For a transfer that might lose its connection, keep partial data in a separate directory:

Bash

rsync -rtv --progress --partial-dir=.rsync-partial -e ssh \
   "$HOME/Projects/camera-app/" \
   alex@192.168.1.50:/home/alex/projects/camera-app/

After a disconnect, rerun that same command. The relative .rsync-partial directory lets rsync reuse partial data while it reconstructs the destination file. It may still scan and compare data, so don’t expect the progress display to jump straight to the previous percentage. Keep the source files unchanged during the retry.

And leave room for temporary files. An update can need space for the existing destination and its replacement at the same time. Check free space on Linux before sending a large model, dataset or disk image.

To skip local clutter, add exclusion patterns:

Bash

rsync -rtv -e ssh \
   --exclude='.DS_Store' --exclude='.git/' --exclude='.venv/' \
   "$HOME/Projects/camera-app/" \
   alex@192.168.1.50:/home/alex/projects/camera-app/

Quote the patterns so the Mac’s shell doesn’t expand them. This example skips .DS_Store and directories named .git or .venv. It doesn’t install the application’s dependencies on Linux; a Mac virtual environment wouldn’t substitute for a Linux environment anyway.

Preview a mirror before deleting

Use –delete only when this dedicated destination should mirror the source. Without it, a file removed from the Mac can remain on the KiwiPi. With it, destination files missing from the source become deletion candidates.

Preview that operation before applying it, using the same exclusions you intend to keep:

Bash

rsync -rtvni --delete -e ssh \
   --exclude='.DS_Store' --exclude='.git/' --exclude='.venv/' \
   "$HOME/Projects/camera-app/" \
   alex@192.168.1.50:/home/alex/projects/camera-app/

Read every *deleting entry and check the destination path. If the preview matches what you intend, repeat the exact command with only -n removed:

Bash

rsync -rtvi --delete -e ssh \
   --exclude='.DS_Store' --exclude='.git/' --exclude='.venv/' \
   "$HOME/Projects/camera-app/" \
   alex@192.168.1.50:/home/alex/projects/camera-app/

This is one-way synchronization. Files created only on the KiwiPi can disappear, so keep recordings and runtime data outside this deployment directory. A mirror also propagates mistakes; use a separate versioned backup for files you need to recover later.

FAQ

Why use -rtv instead of -a?

This example needs recursive copying and modification times. Archive mode also preserves attributes such as permissions and symlinks, and requests ownership-related preservation where allowed. Choose those deliberately when the destination needs them. This command isn’t a complete macOS backup.

How do I use a different SSH port?

Replace -e ssh with -e ‘ssh -p 2222’, using the port your SSH server actually listens on. An existing SSH host alias can also carry the account, address, key and port.

What does rsync: command not found mean?

It can refer to either machine. Check the Mac with command -v rsync and the board with ssh alex@192.168.1.50 ‘command -v rsync’. If plain SSH already fails, fix the login or network connection before changing rsync options.

 

Related Products

Kiwipi-5

KiwiPi 5

The alternative to Raspberry Pi features an RK3588S octa-core 64-bit flagship processor. Built with 8nm technology, it incorporates an ARM Mali-G610 MP4 quad-core GPU and a 6TOPs AI NPU. Its architecture provides high performance and energy efficiency, making it suitable for intensive applications.

Kiwipi-5Pro

KiwiPi 5 Pro

KiwiPi 5 Pro is powered by Rockchip RK3588 8-core 64-bit processor with 4 Cortex-A76 (2.2GHz), 4 Cortex-A55(1.8GHz), and an independent NEON coprocessor.

Kiwipi-5B

KiwiPi 5B

The Kiwi Pi 5B RK3588 single-board computer (SBC), an alternative to the Raspberry Pi 5, features an 8-core CPU, Mali-G610 GPU, and 6 TOPS NPU.

Kiwi Box 1

The RK3588 Mini PC is powered by Rockchip’s latest flagship AIoT SoC built on an 8nm process. Its chipset combines a CPU with a big.LITTLE architecture, featuring four high-performance Cortex-A76 cores and four energy-efficient Cortex-A55 cores, offering a balance of performance and power savings.

Get in Touch about Your Needs

Contact Us