MacOS Terminal commands

$ indicates a Terminal prompt. You might have to scroll to get the full command. Triple click usually selects the complete line and quadruple click the complete paragraph.

Remove the ‘quarantine’ extended attribute from all items in the Applications directory to prevent the ‘verifying application’ process of apps that did not go through the AppStore.

 $ sudo find /Applications/ -print -xattrname -exec xattr -r -d {} \;

Remove empty files from the complete drive. This can be useful when files corrupted by incompletely downloading or a crash of some kind during saving. Use with care! Sometimes these are lock files needed by applications. Skip the -delete part if you just want to check for empty files. Use -type d if you want to find directories rather than files.

 $ find . -type f -empty -print -delete

It can be necessary to remove the hidden .DS_Store files before a directory really is considered empty. By putting the name between wildcards, it is possible to also find those which have been somehow touched by Windows or another OS.

 $ find . -name "*.DS_Store*" -print -delete

If you run into issues with for example Photos not displaying all thumbnails properly or it not analysing faces/people properly, you might have to reset the permissions of your user folder to default.

 $ diskutil resetUserPermissions / `id -u`

The ~/Library/Mail folder contents sometime magically get locked, which can cause trouble if you rebuild your Envelope index. Unlocking the files can be done via Terminal.

 $ find ~/Library/Mail -flags uchg -exec chflags nouchg {} \;

Leave a comment

Your email address will not be published. Required fields are marked *