xattr

パーミッション

書き方

xattr -l [file]

macOS で拡張属性を読み、消します。多くは com.apple.quarantine で、アプリが壊れているという警告の正体です。Linux では getfattr と setfattr を使います。

よく使うオプション

オプション意味
-lList the attributes with their values
-pPrint one named attribute
-wWrite one named attribute
-dDelete one named attribute
-cClear every attribute on the file
-rWork through a directory recursively

xattr -l installer.dmg

Shows com.apple.quarantine on anything downloaded.

xattr -d com.apple.quarantine /Applications/App.app

Clears the flag behind the damaged app warning.

xattr -cr ./MyApp.app

Strips every attribute through the whole bundle.

数字モードと記号モードは同じものを指します。755 と u=rwx,go=rx は同じ意味です。

読み方

  • 角括弧 [ ] は省いてよい部分です。
  • 三点 … は複数並べられるという意味です。
  • オプションは大文字小文字を区別します — -r と -R が別物のコマンドもあります。

よくある質問

Q. xattr は何をしますか。

macOS で拡張属性を読み、消します。多くは com.apple.quarantine で、アプリが壊れているという警告の正体です。Linux では getfattr と setfattr を使います。

Q. どう打ちますか。

xattr -l [file] — 角括弧は省いてよい部分です。

Q. よく使うオプションはいくつですか。

ここにまとめたのは6個です。全部は man xattr にあります。このコマンドはパーミッションの仲間です。

関連するコマンド

man ページ: man xattr