Closed fatso83 closed 1 year ago
Hu Apple must have changed xattr
in 13.2 then as I remember running this command before 13.2 with out complaint.
I’ll need to update the README/wiki later due to this change, strange they’d removed -r
xattr
still uses -r in 13.2:
I'm getting the same output as @emendelson and I'm running Terminal under Rosetta2 so this shouldn't be due an issue with the x86_64 slice.
Tried this on x86 Mini 2018 and I am not seeing an issue. The command line, in the order specified works for me (I am using Ventura 13.2 on Mini 2018 which is x86). Perhaps trying a different order of the arguments? Try moving the "d" to be the argument immediately before the attribute name: xattr -rsd com.apple.quarantine ......
Hi, thank you all for chiming and disproving me. There was another factor that caused this: Homebrew! I only realized this when I saw your responses and promptly checked which executable was being invoked:
$ command -v xattr
/opt/homebrew/bin/xattr
So Homebrew seems to install some xattr
command of its own, shadowing the one built-into macOS:
$ find /bin/ /usr/bin -name xattr
/usr/bin/xattr
Hopefully, this might be of use for others coming across this obscurity.
@fatso83 if you manage to track down what cask/formula installed xattr
please let us known so it can be documented.
Not sure why brew would be even installing it’s own copy of xattr
into $PATH that seems rather unbrew like as it usually don’t replace system provided utility’s with its own even when it makes sense to (like bison)
I tried all kinds of approaches for figuring out what could have installed it, but no packages gave me any hits, so I kind of landed upon this being one of homebrew's own utilities. This was the same on both my mac's, so it's 95% likely it is either in this list of apps (installed by Homebrew): https://github.com/fatso83/dotfiles/blob/master/per-host-config/mac-work/apps.local
Or in the setup: https://github.com/fatso83/dotfiles/blob/5e7885fb9aa6bdfee49991ec454cd71d3fbe43f4/per-host-config/mac-work/setup.sh#L19-L51
I'll try to investigate a bit.
brew does not install xattr by default (at least not on an Apple Silicon system). What happens when you enter brew list
?
I am running both Apple Silicon and Intel macs with the same setup (linked above), so they should be pretty similar (and are in this case wrt xattr). brew list
produces this:
I tried both the brew cache
(custom command) approach and the brew_find_pkg
script in this Stackoverflow thread when trying to figure out what installed this, with no luck.
EDIT
I did some inspecting and looked at what the various executables were. The built-in is a binary executable whereas the /opt/homebrew/bin/xattr
one is just a minimal script calling out to the Python module:
#!/opt/homebrew/opt/python@3.10/bin/python3.10
# -*- coding: utf-8 -*-
import re
import sys
from xattr.tool import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
I can use -r option the day before, but the next day there is no option for -r. Then I run command where xattr
and found that a package called xattr
was installed by pip install
into PATH. It was called before the xattr
that comes with macOS. After deleting this Python package, everything returned to normal. Wish it can help.
I'll add to @hyrulelinks' answer for others that might be struggling with multiple Python installs. This is how you would uninstall correctly:
# Figure out in which python version and location it is installed:
❯ head -1 $(which xattr)
#!/opt/homebrew/opt/python@3.10/bin/python3.10
# Remove it:
❯ PYTHONPATH=/opt/homebrew/opt/python@3.10/site-packages pip3 uninstall xattr
Found existing installation: xattr 0.10.1
Uninstalling xattr-0.10.1:
Would remove:
/opt/homebrew/bin/xattr
/opt/homebrew/lib/python3.10/site-packages/xattr-0.10.1.dist-info/*
/opt/homebrew/lib/python3.10/site-packages/xattr/*
Proceed (Y/n)? y
Successfully uninstalled xattr-0.10.1
EDIT: the problem is really that a Python lib and executable in your path shadows the macOS version. The solution is to just uninstall it.
Seems like the instructions in the README.md do not apply to the latest macOS version.