I'm running OSX 10.15.7. I have a jpg file that I can open when double clicking on Finder, but if I run open test.jpg in the iTerm2 (also in Terminal.app) I get the following error

enter image description here

If I look at the permissions, I have access to it.

$ ls -lt test.jpg
-rw-r--r--@ 1 user  staff  232309 Aug 18 12:45 test.jpg

Question :

  1. Why can I open this file via double clicking in Finder but not when I'm openning from the terminal?

EDIT It turns out that after opening the file with Preview (via double clicking in Finder), I can then open test.jpg via open test.jpg in iTerm2. This is even more perplexing.

  • 1
    What's the file path to the folder? Are you 'user'? Does the file have any ACLs?
    – benwiggy
    Commented Sep 1, 2022 at 16:06
  • I am user, the file is in the current working directory. The permissions are shown above. Commented Sep 1, 2022 at 16:08
  • 1
    Is the 'current working directory' in ~/Documents, or ~/Downloads, for example, and does iTerm have permission to access those folders? Use ls -le test.jpg to see any ACLs.
    – benwiggy
    Commented Sep 1, 2022 at 16:10
  • It is in ~/Projects/path/to/some/custom/dir. I've been programming in this directory using iTerm. I can create a new file ~/Projects/path/to/some/custom/dir/newfile.txt (which is at the same level as test.jpg). The permissions using : -rw-r--r--@ 1 user staff 232309 Aug 18 12:45 test.jpg Commented Sep 1, 2022 at 16:15
  • I can't replicate the behaviour with similar files here (using Terminal). What happens if you try with other image files, either in that dir, or elsewhere?
    – benwiggy
    Commented Sep 1, 2022 at 16:29

1 Answer 1


I finally figured this out. Notice the @ at the end of the file permissions. This denotes extended attributes for the file. E.g.

local: somedir $ ls -lt ch9.pdf
-rw-r--r--@ 1 user  staff  522580 Dec 20 06:53 ch9.pdf
local: somedir $ xattr -l ch9.pdf
00000000  86 A2 A1 B3 00 00 00 00 FB 51 00 00 00  |...c.....ZA/....|
00000000  F2 50 C3 33 F2 DC 4E 4E 7A 8B E2 4F CA  |.Q.3..MNZ<.{..O.|
. more output
000000F0  ED AB 46 F3 E4 F8 B4 1E 84                       |..F......|
com.apple.quarantine: 0082;623d1665;Preview;

Notice the last line, com.apple.quarantine: 0082;623d1665;Preview; is preventing us from opening this file. My guess this is new behavior from a file system update. We can 'fix' this behavior by simply removing it from the extended attributes, and the file will open from the command line just fine.

xattr -d com.apple.quarantine ch9.pdf

You must log in to answer this question.

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