2

I'd like to copy manually into ~/Library/Messages to maintain message history.

The folder is owned by the user, not by root:

% ls -al ~/Library | grep Messages
drwx------   11 sam    staff   352 29 Jun 12:11 Messages

and yet I cannot read the contents

% ls -al ~/Library/Messages
total 0
ls: /Users/sam/Library/Messages: Operation not permitted

Even though it's unclear why I should need to sudo, I try anyway

% sudo ls ~/Library/Messages
Password: 
ls: /Users/sam/Library/Messages: Operation not permitted

but that fails as well.

How can I access ~/Library/Messages (on Monterey)?

Update

Now Terminal can access ~/Library.

% ls ~/Library/Messages
Drafts
...
prewarm.db-wal

and I can set aside the existing ~/Library/Messages

% mv ~/Library/Messages ~/Library/Message-set-aside

but I still cannot rsync

rsync -avz /Volumes/bak/sam/Library/Messages  /Users/sam/Library  >> /tmp/messages-log 2>&1

as it yields

building file list ... done
Messages/
rsync: recv_generator: mkdir "/Users/sam/Library/Messages" failed: Operation not permitted (1)
*** Skipping everything below this failed directory ***

Hints?

1

2 Answers 2

2

That folder has special protection enforced by the kernel for sensitive data. You can open the folder by navigating to it in the Finder. Or you can grant full disk access to the Terminal app in the Security and Privacy preference pane.

3
  • Thanks, but I'd like to use rsync from the command line, not drag-and-drop from the Finder.
    – Sam7919
    Jun 29, 2023 at 20:20
  • The third sentence in the answer tells you how to gain access with Terminal, which should then let you use rsync. Jun 29, 2023 at 20:30
  • @JohnPalmieri The update incorporates what happens—the symptoms, not the cause.
    – Sam7919
    Jun 30, 2023 at 11:15
0

macOS (or at least Monterey) will not let the user rsync into ~/Library/Messages.

It will, however, let you rsync into ~/, and from there you can drag the Messages folder into ~/Library.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .