I only recently discovered (yes, I'm late to the game) that TextEdit.app is adding extended attributes to any files I open in it. I had discovered this when I randomly had opened a shell script in it and it got quarantined and wouldn't run.
I quickly learned that I can remove attributes with either xattr -c file
or individual attributes with xattr -d attrname file
, but doing that is tedious/tiresome. I happen to like TextEdit (which I'm aware is in disfavor among pros). I have other editors for editing code, so I’m not looking for alternate editor suggestions. What I’d like to know is, is there a way to get it to stop adding extended attributes to files?
I tried defaults write com.apple.LaunchServices LSQuarantine -bool false
, but it still happens.
Or maybe I'm being too fastidious? Other than the quarantine attribute, can any of the other cruft get in the way of other users on non-macOS systems, say when in a github repo or otherwise deployed to other systems?
My main concerns are first: getting a quarantine flag that was opened for a quick/simple edit, and second: edits to text files (like README.txt) that are included in a social coding repository (like github). My desire to avoid extended attributes is the same as the reason I remove .DS_Store files before I commit changes to a repo - they are system-specific and are otherwise useless (or possibly obstacles?) to others. TextEdit is for editing text. Scripts and READMEs are text files. I also use it for all sorts of other text files which I process on the command line, like fasta and fastq files. TextEdit (while it definitely lacks features other editors have) has useful features that other editors do not have or do not do well, and I've been using it since the beginning and will continue to use it despite the alternative preference or opinions of others. It has only become a problem the other day, when for some reason, I was unable to run a script that I had run and then opened in TextEdit to make a very minor change, and then found I couldn't run it again.
But perhaps I'm wrong about my main concern? Perhaps it wasn't even TextEdit that added the quarantine attribute, because I've been unable to reproduce that issue. So does TextEdit ever add the quarantine attribute, and if so, when?
I wrote an automator service I can use to remove attributes on selected files, but if there's a way to change TextEdit's behavior, that would be preferable. Otherwise, I'll probably also add an xattr command to my checkin wrapper.