Specifically, opening a terminal and writing open myfile.pdf causes a Dialog box in Preview with

The file “myfile.pdf” couldn’t be opened because you don’t have permission to view it"

To view or change permissions, select the item in the Finder and choose File > Get Info.

Note this also happens with open -a Preview.app myfile.pdf but does not happen for open -a Skim.app myfile.pdf. In addition, this problem only manifested after my MBP forcibly upgraded itself to Catalina 10.15.7 without my consent; everything was working normally before.

Now, the error is totally bogus because the file permissions are -rw-r--r--, the owner of the file is me (i.e., $USER) and the group is staff. What's more, this file resides in $mydir with hundreds of other PDF files. They all have the same file permissions, owner and group IDs. Most of them will open fine with a call to open from the Terminal, but some of them won't. Maddeningly, I cannot determine a straightforward way to isolate what is causing this OS bug.

I have followed other suggestions on this site, to no avail. In fact, I thought I fixed the issue (see here), which involved deleting some Preview Container contents. However, that attempted solution only improved the problem, but did not fix it entirely.

If you have a new suggestion that's not already mentioned elsewhere on this site, I'd be grateful to read it.


Following the request in the comments:

➜ ls -lOe@ myfile.pdf
-rw-r--r--@ 1 $USER  staff  - 1081682  5 Apr  2022 myfile.pdf
    com.apple.lastuseddate#PS        16
    com.apple.quarantine         22
    com.dropbox.attrs        26

Note that I can open the PDF in Preview without any errors if I double click it in Finder (and have Preview set as my default PDF viewer).

I did as requested and executed

cd my/PDFs/folder/
chmod 644 *.pdf
chown $USER:staff *.pdf

Miraculously, myfile.pdf is now open-able in Preview using open -a Preview.app myfile.pdf. Also miraculously, other PDF files in the same folder (let's call them file1.pdf and file2.pdf) remain unopen-able using open -a Preview.app ... but they can still be opened in Preview by double clicking in Finder with Preview as default; or via open -a Skim.app file1.pdf.


I have deleted the com.apple.quarantine extended attribute from the files by running

xattr -d com.apple.quarantine *.pdf

as suggested here. So far, I have not come across a PDF that won't open in Preview using open -a Preview.app .... If the problem appears not to persist, I will happily accept an answer from @David Anderson if they wish to post one, or I will write one myself to this effect.

  • 1
    What does ls -lOe@ my file.pdf show? This will include file flags (-O), Access Control Lists (-e) and extended attributes (-@). Jan 21, 2023 at 22:21
  • Is this specific to Terminal and open? What happens when you use Finder and open it in Preview from there?
    – Gilby
    Jan 21, 2023 at 23:20
  • Just for grins and giggles, try resetting the permissions on the file: chmod 644 myfile.pdf and the owner chown bashfuloctopus:staff myfile.pdf then try opening it again.
    – Allan
    Jan 21, 2023 at 23:40
  • I have added the information above, as an edit to my question. In essence: there is more confusing behaviour and the problem is not resolved by resetting permissions + ownerships. @David please let me know if you spot anything from the flags, ACLs and extended attributes; I am unaccustomed to looking at these items. Jan 22, 2023 at 18:20

1 Answer 1


You can view file flags, access control lists (ACLs) and extended attributes for all the .pdf files in the current working directory by entering the command below.

ls -lOe@ *.pdf

Note: The option -O is for file flags, -e is for Access Control Lists and -@ is for extended attributes.

As the OP already stated, the com.apple.quarantine extended attribute was causing the problem. The OP removed this extended attribute by entering the command below.

xattr -d com.apple.quarantine *.pdf


The command below can be used to remove most existing file flags.

chflags noopaque,dump,nouappnd,nouchg,nohidden *.pdf

Note: Using dump instead of nodump is not a mistake.

Or, the following more comprehensive command may be used.

sudo chflags 0 *.pdf

The command below can be used to remove most existing access control lists (ACLs).

chmod -N *.pdf

Finally, the command below can be used to remove most existing extended attributes.

xattr -c *.pdf

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .