I'm trying to change the default app that handles txt files from native TextEdit to Brackets. To achieve this, i'm doing :

1 - Click on a TXT file with the right mouse button, Open With > Other

2 - Select Brackets on the list and check Always open with

3 - Click Open.

After that, i get the error screen below. How can i achieve this task ?

enter image description here

  • Open your chosen app first, by right click/Open. That should inform Gatekeeper. Then you can right click the txt file & open with. – Tetsujin Dec 6 '18 at 16:24
  • @Tetsujin I can use Open with, but when i try to change the default app in the Open With window, i get the error above. – delphirules Dec 6 '18 at 17:04
  • Did you make sure the app would open first? if you don't tell Gatekeeper you want it to launch, it will refuse if you try to do your 'open with' before authorising the app. – Tetsujin Dec 6 '18 at 17:06

I think the steps you were trying would normally work, but it looks like your text file was likely quarantined (browsers and mail clients usually quarantine "unsafe" files by default, and text files are considered unsafe because they could be shell scripts).

The quarantine marker is stored as an "extended attribute", which is a kind of metadata attached to the file in the filesystem's data structures. The exact ID of the quarantine attribute is "com.apple.quarantine". The xattr(1) command can be used to create, view, edit, and delete extended attributes.

So, first remove the quarantine (extended attribute) from the text file you're trying to open:

xattr -d com.apple.quarantine codes.txt

…then follow the steps you were already trying.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.