xattr
パーミッション
書き方
xattr -l [file]macOS で拡張属性を読み、消します。多くは com.apple.quarantine で、アプリが壊れているという警告の正体です。Linux では getfattr と setfattr を使います。
よく使うオプション
| オプション | 意味 |
|---|---|
| -l | List the attributes with their values |
| -p | Print one named attribute |
| -w | Write one named attribute |
| -d | Delete one named attribute |
| -c | Clear every attribute on the file |
| -r | Work through a directory recursively |
例
xattr -l installer.dmgShows com.apple.quarantine on anything downloaded.
xattr -d com.apple.quarantine /Applications/App.appClears the flag behind the damaged app warning.
xattr -cr ./MyApp.appStrips 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