Skip to content

Cross-session sync broken on macOS — stat -c is Linux-only #2

Description

@numarulunu

Running into a hard failure on macOS Sonoma 14.2 when the sync script tries to check file modification times.

The error is:

stat: illegal option -- c
usage: stat [-FLnq] [-f format | -l | -r | -s | -x] [-t timefmt] [file ...]

The issue is that stat -c '%Y' is a GNU coreutils thing. macOS ships with BSD stat, which uses stat -f '%m' for the same thing.

Quick fix would be something like:

if [[ "$OSTYPE" == "darwin"* ]]; then
    mod_time=$(stat -f '%m' "$file")
else
    mod_time=$(stat -c '%Y' "$file")
fi

Or just use date -r which works on both, though it's slower for batch operations.

I can submit a PR if you want — just wanted to flag it first since it completely blocks macOS usage right now.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions