parallel-disk-usage icon indicating copy to clipboard operation
parallel-disk-usage copied to clipboard

Lots of errors on runtime on macOS by default

Open thebitstick opened this issue 2 years ago • 4 comments

The macOS file system is very picky about reading going through a user's home directory, so after approving the terminal app to access Reminders, Photos etc, pdu spits out these errors:

[error] read_dir "./Library/SafariTechnologyPreview": Operation not permitted (os error 1)
[error] read_dir "./.Trash": Operation not permitted (os error 1)
[error] read_dir "./Library/DuetExpertCenter": Operation not permitted (os error 1)
[error] read_dir "./Library/Autosave Information": Operation not permitted (os error 1)
[error] read_dir "./Library/IdentityServices": Operation not permitted (os error 1)
[error] read_dir "./Library/Accounts": Operation not permitted (os error 1)
[error] read_dir "./Library/Safari": Operation not permitted (os error 1)
[error] read_dir "./Library/Biome": Operation not permitted (os error 1)
[error] read_dir "./Library/Shortcuts": Operation not permitted (os error 1)
[error] read_dir "./Library/Messages": Operation not permitted (os error 1)
[error] read_dir "./Library/HomeKit": Operation not permitted (os error 1)
[error] read_dir "./Library/Sharing": Operation not permitted (os error 1)
[error] read_dir "./Library/Mail": Operation not permitted (os error 1)
[error] read_dir "./Library/Containers/com.apple.VoiceMemos": Operation not permitted (os error 1)
[error] read_dir "./Library/Containers/com.apple.archiveutility": Operation not permitted (os error 1)
[error] read_dir "./Library/CoreFollowUp": Operation not permitted (os error 1)
[error] read_dir "./Library/StatusKit": Operation not permitted (os error 1)
[error] read_dir "./Library/Cookies": Operation not permitted (os error 1)
[error] read_dir "./Library/Caches/com.apple.HomeKit": Operation not permitted (os error 1)
[error] read_dir "./Library/Caches/CloudKit": Operation not permitted (os error 1)
[error] read_dir "./Library/Caches/com.apple.Safari": Operation not permitted (os error 1)
[error] read_dir "./Library/Suggestions": Operation not permitted (os error 1)
[error] read_dir "./Library/Metadata/CoreSpotlight": Operation not permitted (os error 1)
[error] read_dir "./Library/Metadata/com.apple.IntelligentSuggestions": Operation not permitted (os error 1)
[error] read_dir "./Library/Group Containers/group.com.apple.secure-control-center-preferences": Operation not permitted (os error 1)
[error] read_dir "./Library/PersonalizationPortrait": Operation not permitted (os error 1)
[error] read_dir "./Library/Group Containers/group.com.apple.notes": Operation not permitted (os error 1)
[error] read_dir "./Library/Caches/FamilyCircle": Operation not permitted (os error 1)
[error] read_dir "./Library/Caches/com.apple.homed": Operation not permitted (os error 1)
[error] read_dir "./Library/Caches/com.apple.ap.adprivacyd": Operation not permitted (os error 1)
[error] read_dir "./Library/Application Support/MobileSync": Operation not permitted (os error 1)
[error] read_dir "./Library/Application Support/CallHistoryTransactions": Operation not permitted (os error 1)
[error] read_dir "./Library/Application Support/com.apple.AuthenticationServices/CredentialProviders": Operation not permitted (os error 1)
[error] read_dir "./Library/Containers/com.apple.Notes": Operation not permitted (os error 1)
[error] read_dir "./Library/Containers/com.apple.Home": Operation not permitted (os error 1)
[error] read_dir "./Library/Containers/com.apple.Safari": Operation not permitted (os error 1)
[error] read_dir "./Library/Containers/com.apple.news": Operation not permitted (os error 1)
[error] read_dir "./Library/Application Support/CloudDocs/session/db": Operation not permitted (os error 1)
[error] read_dir "./Library/Application Support/com.apple.sharedfilelist": Operation not permitted (os error 1)
[error] read_dir "./Library/Application Support/Knowledge": Operation not permitted (os error 1)
[error] read_dir "./Library/Application Support/com.apple.TCC": Operation not permitted (os error 1)
[error] read_dir "./Library/Application Support/FileProvider": Operation not permitted (os error 1)
[error] read_dir "./Library/Application Support/com.apple.avfoundation/Frecents": Operation not permitted (os error 1)
[error] read_dir "./Library/Application Support/CallHistoryDB": Operation not permitted (os error 1)
[error] read_dir "./Library/Containers/com.apple.CloudDocs.MobileDocumentsFileProvider": Operation not permitted (os error 1)
[error] read_dir "./Library/Containers/com.apple.mail": Operation not permitted (os error 1)
[error] read_dir "./Library/Containers/com.apple.corerecents.recentsd/Data/Library/Recents": Operation not permitted (os error 1)
[error] read_dir "./Library/Containers/com.apple.stocks": Operation not permitted (os error 1)
[error] read_dir "./Library/Containers/com.apple.SafariTechnologyPreview": Operation not permitted (os error 1)
[error] read_dir "./Library/Assistant/SiriVocabulary": Operation not permitted (os error 1)

On the contrast, dust spits out this error:

Did not have permissions for all directories

And both GNU du and BSD du on macOS spits out these errors:

du: cannot read directory './Library/SafariTechnologyPreview': Operation not permitted
du: cannot read directory './Library/Application Support/MobileSync': Operation not permitted
du: cannot read directory './Library/Application Support/CallHistoryTransactions': Operation not permitted
du: cannot read directory './Library/Application Support/com.apple.AuthenticationServices/CredentialProviders': Operation not permitted
du: cannot read directory './Library/Application Support/CloudDocs/session/db': Operation not permitted
du: cannot read directory './Library/Application Support/com.apple.sharedfilelist': Operation not permitted
du: cannot read directory './Library/Application Support/Knowledge': Operation not permitted
du: cannot read directory './Library/Application Support/com.apple.TCC': Operation not permitted
du: cannot read directory './Library/Application Support/FileProvider': Operation not permitted
du: cannot read directory './Library/Application Support/com.apple.avfoundation/Frecents': Operation not permitted
du: cannot read directory './Library/Application Support/CallHistoryDB': Operation not permitted
du: cannot read directory './Library/Assistant/SiriVocabulary': Operation not permitted
du: cannot read directory './Library/Autosave Information': Operation not permitted
du: cannot read directory './Library/IdentityServices': Operation not permitted
du: cannot read directory './Library/Messages': Operation not permitted
du: cannot read directory './Library/HomeKit': Operation not permitted
du: cannot read directory './Library/Sharing': Operation not permitted
du: cannot read directory './Library/Mail': Operation not permitted
du: cannot read directory './Library/DuetExpertCenter': Operation not permitted
du: cannot read directory './Library/Accounts': Operation not permitted
du: cannot read directory './Library/Safari': Operation not permitted
du: cannot read directory './Library/Biome': Operation not permitted
du: cannot read directory './Library/Shortcuts': Operation not permitted
du: cannot read directory './Library/Suggestions': Operation not permitted
du: cannot read directory './Library/Group Containers/group.com.apple.secure-control-center-preferences': Operation not permitted
du: cannot read directory './Library/Group Containers/group.com.apple.notes': Operation not permitted
du: cannot read directory './Library/Containers/com.apple.VoiceMemos': Operation not permitted
du: cannot read directory './Library/Containers/com.apple.archiveutility': Operation not permitted
du: cannot read directory './Library/Containers/com.apple.Home': Operation not permitted
du: cannot read directory './Library/Containers/com.apple.Safari': Operation not permitted
du: cannot read directory './Library/Containers/com.apple.CloudDocs.MobileDocumentsFileProvider': Operation not permitted
du: cannot read directory './Library/Containers/com.apple.mail': Operation not permitted
du: cannot read directory './Library/Containers/com.apple.Notes': Operation not permitted
du: cannot read directory './Library/Containers/com.apple.news': Operation not permitted
du: cannot read directory './Library/Containers/com.apple.corerecents.recentsd/Data/Library/Recents': Operation not permitted
du: cannot read directory './Library/Containers/com.apple.stocks': Operation not permitted
du: cannot read directory './Library/Containers/com.apple.SafariTechnologyPreview': Operation not permitted
du: cannot read directory './Library/PersonalizationPortrait': Operation not permitted
du: cannot read directory './Library/Metadata/CoreSpotlight': Operation not permitted
du: cannot read directory './Library/Metadata/com.apple.IntelligentSuggestions': Operation not permitted
du: cannot read directory './Library/Cookies': Operation not permitted
du: cannot read directory './Library/CoreFollowUp': Operation not permitted
du: cannot read directory './Library/StatusKit': Operation not permitted
du: cannot read directory './Library/Caches/com.apple.HomeKit': Operation not permitted
du: cannot read directory './Library/Caches/CloudKit': Operation not permitted
du: cannot read directory './Library/Caches/com.apple.Safari': Operation not permitted
du: cannot read directory './Library/Caches/FamilyCircle': Operation not permitted
du: cannot read directory './Library/Caches/com.apple.homed': Operation not permitted
du: cannot read directory './Library/Caches/com.apple.ap.adprivacyd': Operation not permitted

thebitstick avatar May 05 '22 00:05 thebitstick

Can you describe what behavior you want to change?

I don't have a MacBook so I may not understand your situation, but can you run chown -R or something to give permission?

If you want to scan all files and directories under $HOME except $HOME/Library then I'm afraid that for now, the only way to do it is to supply all home subdirectories as CLI arguments (pdu ~/dir1 ~/dir2 ~/file1 ...)

KSXGitHub avatar May 05 '22 02:05 KSXGitHub

Apple is very restrictive with the filesystem, so running chown -R doesn't work. The problem folders are 'owned' by me, but the OS decides not to give access to apps for "security purposes".

Is there an option yet to exclude a directory?

thebitstick avatar May 05 '22 03:05 thebitstick

Is there an option yet to exclude a directory?

No. At least not yet. This is because I want to follow 2 of the principles of the UNIX Philosophy (minimalism and composability). There should be a program capable of listing all current files/directories except certain pattern, for example:

pdu $(find . -maxdepth 1 -mindepth 1 -name '*' -a -not -name Library)
pdu $(fd -d 1 -E Library)

Related issue: https://github.com/KSXGitHub/parallel-disk-usage/issues/86

KSXGitHub avatar May 05 '22 04:05 KSXGitHub

follow 2 of the principles of the UNIX Philosophy (minimalism and composability).

The Unix edition of du has the -I option which excludes a "mask", but it doesn't have an exclude directory option, so you have a fair point!

thebitstick avatar May 05 '22 04:05 thebitstick