26

I had to force-quit Preview (it became unresponsive after trying to open a 200Mb animated gif), but after re-starting it, some files that were open before no longer open. Instead an error box pops up saying that

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

and

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

(how can I generate an image of that error box?).

However, the file permissions are okay, finder generated the usual preview, and acroread can open the file. I suspect that Preview has generated some lock for this file somewhere, but I'm not sure where and how. OSX 10.9.5. (copying the file in a terminal to another one and trying to open that didn't help, as did changing permissions to read-write for everyone).

3 Answers 3

38

quitting preview was enough to fix it for me.

4
  • 2
    Worked for me... strange bug
    – Shaun
    Jul 4, 2016 at 17:58
  • 1
    Just opening preview and quitting didn't work for me. But opening and then force quitting seemed to work for some reason.
    – Andrew
    Aug 22, 2016 at 9:29
  • I think preview just locks the resources and does not release it.. This solution is good :) Nov 21, 2016 at 6:45
  • Well, this did not help with the original problem, as stated in the problem. So, this does not answer the original question.
    – Walter
    Oct 23, 2017 at 8:02
17

After searching on the net I found a solution, following mainly this suggestion, though only deleting a small sub-directory:

  1. I removed the sub-directory ~/Library/Containers/com.apple.Preview/Data/Library/Saved Application State/com.apple.Preview.savedState

  2. I quit Preview and re-started it.

PS: In recent versions of macOS the save state is kept in ~/Library/Saved\ Application\ State/com.apple.Preview.savedState.

0

I tried all of the above on a file that couldn't "be opened because of permissions" except by preview; nothing worked. :(

I then checked the file permissions in terminal:

term> ls -laF ~/Desktop/BadFile.pdf

-rwxr--r--@ 1 geowar staff 199754545 Jun 12 2020 3D BadFile.pdf*

That should be good enough to read the file… but just in case

term> chmod +w+x ~/Desktop/BadFile.pdf

-rwxrwxrwx@ 1 geowar staff 199754545 Jun 12 2020 3D BadFile.pdf*

Still couldn't open it.

Then I checked to see if some other process already had the file open:

term> lsof | grep 'BadFile.pdf'

Preview 33967 geowar txt REG 1,13 199754545 22843389 /Users/Desktop/BadFile.pdf

Preview has it open… so… quit preview… and now I can open the file!

Weird…

You must log in to answer this question.

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