11

I used iTunes to make a backup of my iPhone. I can see the backup directory using Finder, at /Users/ronaldfischer/Library/Application Support/MobileSync/Backup. Strangely, when doing something like

ls "/Users/ronaldfischer/Library/Application Support/MobileSync"

or

du -ms "/Users/ronaldfischer/Library/Application Support/MobileSync/Backup"

I get an error message i.e. ls: MobileSync: Operation not permitted. But when I do a

ls -ld "/Users/ronaldfischer/Library/Application Support/MobileSync"

I see

drwxr-xr-x@ 3 ronaldfischer  staff  96 Sep 15 14:08 /Users/ronaldfischer/Library/Application Support/MobileSync

Hence I should have suffient permissions, plus Finder too can go into this directory without requiring me to switch to root rights.

Where does the permission problem come from?

UPDATE:

Running xattr on the directory MobileSync showed that it has the attribute com.apple.quarantine being set. This attribute is usually set on (usually an executable) file which is downloaded from somewhere, and ensures that MacOS is asking you "Do you really trust this file?" the first time it is opened. Maybe the attribute has been set because backing up my iPhone in effect means that external programs are downloaded.

However, this is likely not the reason of the strange behaviour, because I also get an operation not permitted, when I try to remove this attribute using xattr -d. Furthermore, @Seamus said in his comment, that he did not have this attribute being set, but also has no permission. Perhaps it is a glitch in this OS version? I'm still running Mojave (10.14.6).

4
  • 2
    The '@' character at the end of the permissions list on /MobileSync indicates that it has extended attributes. I just looked at the same directory on my user account, and this directory does not have extended attributes. You can look at which attributes are set by using the xattr terminal command. Here's an excellent guide to using xattr command to delve further into your mystery.
    – IconDaemon
    Commented Mar 1, 2020 at 17:35
  • @IconDaemon: That oughta' be an answer :)
    – Seamus
    Commented Mar 1, 2020 at 19:19
  • 2
    Well, its a trouble shooting comment to further help user1934428 figure out why that directory has the xattr flag set. It is not an answer, per se. As I stated, the equivalent directory on my Mac does not have the xattr flag set, and I can't divine why it is happening on the OP's directory. Should the OP find out why, and fix the problem, my hope is that it is reported back and that I helped to find a solution.
    – IconDaemon
    Commented Mar 1, 2020 at 19:35
  • @IconDaemon: Yeah - it's confusing... I tried this on my Mojave and Catalina systems just now. Like the OP, ls -la gets an error: ls: MobileSync: Operation not permitted. But unlike the OP, I see no extended attributes when I do ls -ld.
    – Seamus
    Commented Mar 2, 2020 at 23:25

1 Answer 1

14

You'll be able to read the directory if you grant Full Disk Access to your terminal program (e.g. Terminal.app or iTerm2).

In macOS 13 Ventura: Apple Menu › System Settings › Privacy & Security › Full Disk Access.

In previous verisons of macOS: Apple Menu › System Preferences › Security & Privacy › Privacy › Full Disk Access.

4
  • The Terminal.app doesn't have "Settings". It has "Preferences", but there is no "Security&Privacy" in this menu. Only "General", "Profiles", "Window Groups" and "Encodings". This is "Terminal 2.9.5". Commented May 8, 2020 at 17:15
  • Sorry, I meant system settings. I've updated the answer.
    – duozmo
    Commented May 8, 2020 at 18:53
  • This worked on macOS 11.6 Big Sur when running rsync (macOS version) from a bash script - many Apple-managed files under ~/Library gave 'operation not permitted. Granting Full Disk Access to /usr/bin/rsync did nothing, but granting this to Terminal.app worked. Perhaps because Terminal.app is more of a 'macOS native' app and its privileges are inherited down to bash and rsync?
    – RichVel
    Commented Feb 11, 2023 at 16:33
  • @RichVel Sorry, by "terminal program," I meant Terminal.app and similar. I've updated the answer.
    – duozmo
    Commented Feb 11, 2023 at 20:11

You must log in to answer this question.

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