rb · guides
rafabenedetti.com
user guides · 2026
Reference · User guide

projsync: user guide

One zsh script that keeps a project folder identical on a working SSD and a media drive, and moves its Final Cut Pro library between them whole. Install, setup, everyday use, the safety rules it enforces, and how to migrate an existing sync.

projsync keeps a project’s folder identical on two disks, a fast working SSD and a media drive, and moves its Final Cut Pro library between them whole. It does for any project what the course, lib-in and lib-out functions did for COURSE alone. Each project gets a small config file; the commands take the project’s name.

It does two different jobs, because FCP libraries can’t be synced file by file:

JobCommandHow
Project folder (footage, exports, docs, transcripts)projsync sync NAMETwo-way with unison: new and changed files flow both ways, deletions too, and a file changed on both sides is shown as a conflict for you to settle
FCP library (.fcpbundle)projsync lib-in NAME / lib-out NAMEOne-way, whole: copied to a temporary name, then swapped in, with the copy it replaced kept as .old

Every command refuses to run while FCP is open, or while a drive is missing.


1. How it works

Folders sync both ways; the library moves whole

The project folder is the only thing unison touches. The library crosses in one direction at a time, whichever way you send it, and FCP must be closed for all three.

2. Install

projsync is one zsh script. It needs unison for the folder sync; the library copies use macOS’s own ditto.

  1. Install unison: brew install unison.

  2. Put the script in ~/bin (already on your PATH from ~/.zshrc) and make it runnable:

    mkdir -p ~/bin
    mv ~/Downloads/projsync ~/bin/projsync
    chmod +x ~/bin/projsync
    projsync --version        # projsync 0.1.0
  3. Give every external drive you sync a permanent ID, once per drive:

    projsync id-drive /Volumes/media
    projsync id-drive /Volumes/RB_SATmedia

    This writes an 8-character ID to a hidden .drive_id file at the drive’s top level. A drive that already has one (the media drive does, from COURSE) keeps it.

Why the IDs matter: your drives share names. Two different drives both mounted as /Volumes/media look like the same folder to unison, and it would treat files missing from the second drive as deletions to copy back. With an ID per drive, unison keeps a separate record for each pairing, so plugging in a different drive starts a fresh comparison instead.

3. Setting up a project

projsync new NAME writes a config at ~/.config/projsync/NAME.conf and opens it in your editor ($EDITOR, or nano). The name is how you’ll refer to the project from then on: letters, digits, ., _ and -.

projsync new MyCourse

Fill in the paths. All must be absolute.

# The project folder on each side. Same layout inside both.
SSD_ROOT="/Volumes/RB_SATmedia/MyCourse"
DRIVE_ROOT="/Volumes/media/MyCourse"

# Optional: the FCP library, copied whole by lib-in / lib-out.
LIB_SSD="/Volumes/RB_SATmedia/Libraries/MyCourse_v1_rb.fcpbundle"
LIB_DRIVE="/Volumes/media/MyCourse/fcp_libraries/v1/master-libraries/MyCourse_v1_rb.fcpbundle"

# Optional: more things sync should skip
IGNORE=(
  "Path exports/v1/audio_for_transcripts"
  "Name *.tmp"
)

# Optional, advanced: pin unison's archive name
UNISON_HOSTNAME=""
SettingRequiredMeaning
SSD_ROOTyesThe project folder on the working disk. Can be on the internal drive too
DRIVE_ROOTyesThe same project folder on the media drive
LIB_SSD, LIB_DRIVEfor lib-in/lib-outWhere the library sits on each side. The library can live outside the project folder, as the COURSE library does on the SSD
IGNOREnoExtra unison patterns. Path is one folder or file relative to the root; Name matches a name anywhere
UNISON_HOSTNAMEnoLeave empty. Used only to carry an existing unison history across (see section 6)

Sync already skips, without being told: every .fcpbundle and its .old/.incoming copies, .DS_Store, ._* files, the drive ID, and the hidden macOS folders (.Spotlight-V100, .fseventsd, .Trashes, .TemporaryItems).

If one side doesn’t exist yet (a new SSD copy), create the empty folder and the first sync fills it:

mkdir -p "/Volumes/RB_SATmedia/MyCourse"
projsync check MyCourse

4. Everyday use

CommandWhat it does
projsync listLists your configured projects
projsync check NAMEReports on drives, IDs, both folders, both libraries and FCP. Changes nothing; exits 1 if anything blocks a sync
projsync sync NAMECompares the two folders, shows every change, and asks before copying anything
projsync sync NAME -yApplies every non-conflicting change without asking. Conflicts are skipped and listed for a later interactive run
projsync lib-in NAMECopies the library from the SSD to the drive
projsync lib-out NAMECopies the library from the drive to the SSD
projsync edit NAMEOpens the config
projsync id-drive VOLUMEGives a drive its ID (once per drive)

In an interactive sync, the SSD is the left column and the drive the right. unison proposes a direction for each change and waits on each line:

KeyMeaning
Return or faccept the proposed direction
>copy SSD to drive
<copy drive to SSD
/skip this one for now
dshow the difference (text files)
qquit without changing anything

After the last item it asks “Proceed with propagating updates?”; y applies them. A conflict (<-?->) has no default: pick a side or skip it.

A typical day working off the SSD:

# morning: bring the SSD up to date
projsync check MyCourse
projsync lib-out MyCourse     # only if the library was last edited from the drive
projsync sync MyCourse

# … edit in FCP …

# evening: quit FCP, then send everything back
projsync lib-in MyCourse
projsync sync MyCourse

5. Safety rules it enforces

RuleWhy
Refuses while Final Cut Pro is runningFCP writes into the library and caches continuously; copying mid-write gives a corrupt library
Refuses if a drive isn’t truly mountedA leftover empty /Volumes/media folder after an unclean eject looks like an empty drive, and syncing against it would read as “delete everything”. projsync checks the folder is a real mount, not a stray directory
Refuses a drive with no IDWithout one, two same-named drives would share unison’s history (section 2, step 3)
Never syncs a .fcpbundleA library is thousands of database files that only make sense together. A file-by-file merge from two sides breaks it
Copies libraries to a temp name firstIf the copy fails partway, the destination library is untouched
Keeps the replaced library as .oldOne undo for a copy in the wrong direction. Only the latest .old is kept, so check it before the next copy
Stops on big deletions-confirmbigdel makes unison halt if one side appears to have lost everything
Asks before every change by default-y is for when you know what changed; conflicts are never resolved for you

What it doesn’t protect against: editing the same library on both sides between copies. lib-in and lib-out overwrite whole; there’s no merge. Keep one rule: the library is edited on one disk at a time, and you move it before switching.

Wrong-direction library copy, undone:

cd "/Volumes/media/MyCourse/fcp_libraries/v1/master-libraries"
rm -rf MyCourse_v1_rb.fcpbundle
mv MyCourse_v1_rb.fcpbundle.old MyCourse_v1_rb.fcpbundle

6. Moving a project off hand-written sync functions

COURSE moved to projsync on 1 Oct 2026, and its unison history carried over: the first projsync sync COURSE reported “Nothing to do: replicas have not changed since last sync.” These are the steps that worked, for any other project that has its own unison profile and zsh functions.

  1. List what the old profile sets:

    grep -E '^(root|ignore)' ~/.unison/course.prf
    grep -vE '^(root|ignore|#|$)' ~/.unison/course.prf
  2. Map each old setting onto projsync:

    In the old profile or functionIn projsync
    root = … (two lines)SSD_ROOT and DRIVE_ROOT. Their order doesn’t affect the history, but the columns follow projsync: left is always the SSD
    ignore = Name *.fcpbundle, .DS_Store, .Spotlight-V100, .fseventsd, .TemporaryItemsbuilt in; leave them out
    any other ignore = … lineone quoted entry in IGNORE, without the ignore =
    times = true, perms = 0built in
    batch = falsethe default; -y turns batch on for one run
    maxthreads = 8dropped; unison’s own default applies
    UNISONLOCALHOSTNAME="drive$id" in the functionUNISON_HOSTNAME="drive<ID>", typed as a fixed string (driveA for the media drive)
  3. Write the config from the shell rather than pasting into the editor. The COURSE config as it stands:

    cat > ~/.config/projsync/COURSE.conf <<'EOF'
    SSD_ROOT="/Volumes/RB_SATmedia/COURSE_project"
    DRIVE_ROOT="/Volumes/media/COURSE_project"
    LIB_SSD="/Volumes/RB_SATmedia/Libraries/COURSE_v1_rb.fcpbundle"
    LIB_DRIVE="/Volumes/media/COURSE_project/fcp_libraries/v1/master-libraries/COURSE_v1_rb.fcpbundle"
    IGNORE=(
      "Path assets/raw_footage"
      "Name {Render Files}"
      "Name {Transcoded Media}"
      "Name {Analysis Files}"
    )
    UNISON_HOSTNAME="driveA"
    EOF

    The Path assets/raw_footage line is the one not to miss: without it the first sync would copy every camera file between the drives.

  4. Give any drive without an ID its ID, then check and run one interactive sync with FCP closed:

    projsync id-drive /Volumes/RB_SATmedia
    projsync check COURSE
    projsync sync COURSE

    “Nothing to do”, or only the files changed since the last old-style sync, means the history carried over. A list of hundreds of files means it didn’t: press q and compare the roots and hostname with the old profile before approving anything.

  5. Swap the old functions for aliases. Delete the old block first: zsh expands an alias anywhere its name appears, so an alias named course would break a later course() { definition in the same file.

    cp ~/.zshrc ~/.zshrc.bak
    sed -i '' '/^# --- COURSE sync ---$/,/^# --- end COURSE sync ---$/d' ~/.zshrc
    grep -n 'COURSE\|lib-in\|lib-out\|_lib_move' ~/.zshrc      # should print nothing
    cat >> ~/.zshrc <<'EOF'
    
    # --- project sync (projsync) ---
    alias course='projsync sync COURSE'
    alias lib-in='projsync lib-in COURSE'
    alias lib-out='projsync lib-out COURSE'
    EOF

    Then open a new Terminal window (or run exec zsh on its own line) and check with type course lib-in lib-out. ~/.zshrc.bak keeps the old functions. The old ~/.unison/course.prf is no longer read and can go; keep the rest of ~/.unison, which holds the sync history.

For every new project, leave UNISON_HOSTNAME empty.

7. Troubleshooting

MessageFix
quit Final Cut Pro firstQuit FCP (not just close the library) and run again
/Volumes/X is not mountedPlug in the drive. If Finder shows it as media 1, eject every drive called media, delete the stray /Volumes/media folder if one remains, and remount
has no ID yetprojsync id-drive /Volumes/X
… does not existOne side’s project folder is missing. Check the path, or mkdir -p it for a new copy
unison not installedbrew install unison
unison stops on a “big deletion”One side looks emptied. Check the right drive is mounted before you agree to anything
Thousands of changes on a first syncNormal when two copies were never synced before. Identical files are only recorded, not copied, but the first scan of a large project takes a while
set LIB_SSD and LIB_DRIVEAdd the library paths to the config (projsync edit NAME)
copy failed; destination untouchedUsually a full disk. Free space and run again; nothing was replaced

Never paste projsync new or projsync edit together with the commands after it. The editor opens, and everything queued behind it runs the moment you close it, before your config is filled in. The checks stop it doing harm, but the output is confusing. The same goes for exec zsh: anything pasted after it is dropped by the new shell.