How do I remove the “extended attributes” on a file in Mac OS X?

前端 未结 5 1709
时光说笑
时光说笑 2020-12-02 03:22

I have an AppleScript script that runs a stress test. Part of the test is to open, save, and close certain files. Somehow, the files have picked up some \"extended attribute

5条回答
  •  情书的邮戳
    2020-12-02 03:56

    Use the xattr command. You can inspect the extended attributes:

    $ xattr s.7z
    com.apple.metadata:kMDItemWhereFroms
    com.apple.quarantine
    

    and use the -d option to delete one extended attribute:

    $ xattr -d com.apple.quarantine s.7z
    $ xattr s.7z
    com.apple.metadata:kMDItemWhereFroms
    

    you can also use the -c option to remove all extended attributes:

    $ xattr -c s.7z
    $ xattr s.7z
    

    xattr -h will show you the command line options, and xattr has a man page.

提交回复
热议问题