3

Whenever I hit open blah.png (any image type) in my terminal, I get a message "Preview quit unexpectedly" from Mac OS X. The solution is to just open the folder in Finder using open ., navigating to the file and opening it from there. Preview seems to work fine then. However, this is annoying.

Any ideas why I can't open images from the terminal?

My OS X version is 10.10.5 (14F1808). By the way, when I hit ``open receptor.png'' (where receptor.png is the filename), the terminal now also says: "LSOpenURLsWithRole() failed with error -10810 for the file /Users/asdf/receptor.png." I don't know why I didn't notice that before.

11
  • 1
    In Terminal, can you test the following with an image file that's known to crash Preview when using open filename, for testing purposes use instead, open -a Preview filename. Does it still crash Preview? Commented Jul 25, 2016 at 17:42
  • hey, thanks for the response --- yeah unfortunately I get exactly the same error message ...
    – Hinton
    Commented Jul 26, 2016 at 19:00
  • 1
    What version of OS X are you using? What size are the files you are trying to open? Commented Aug 2, 2016 at 22:33
  • I'm using Mac OS version 10.10.5 (14F1808) . The size of the files varies. But one test png for example is 149K. I added a little more information to the question
    – Hinton
    Commented Aug 3, 2016 at 20:57
  • 1
    @Hinton try chmod +x on the file, anything then? Commented Aug 4, 2016 at 20:50

1 Answer 1

1
+50

There are a number of cache-type files that will clear most issues with Preview, if you delete them. I've also heard of several similar issues arising out of ACL (Access Control Lists) being out of sync across your system.

First reset the ACL for your account, like this. Use this as a more detailed reference as needed. Just to remedy Preview.app issues, You probably do not need to remove all the permissions on your account, so ignore their first step where they are using chmod in the terminal. I would reccomend:

  • Restart the computer, and on the chime, hold down Cmd+R
  • At the top of the screen, chose "Utilities" --> "Terminal"
  • In Terminal type resetpassword (you can also use one of your old passwords)
  • Click on "Save"
  • Press "Reset" (just below), which resets the Access Control Lists.

Now login to your computer, and remove the Preview cache & preference files. I've used this link as a reference to confirm the locations:

Open Finder and then navigate to your User Library by holding alt, and chosing from the "Go" menu at the top, "Library." If you're confident with the terminal, of course you can also delete them that way. For example: cd $HOME/Library/ then rm -Rf [each file below]. Don't use terminal if you are not used to it!

clear the various caches and temporary files related to Preview by deleting:

  • 'Containers/com.apple.Preview'
  • 'Containers/com.apple.quicklook.ui.helper'
  • 'Preferences/com.apple.Preview.LSSharedFileList.plist'
  • 'Preferences/com.apple.Preview.SandboxedPersistentURLs.LSSharedFileList.plist'
  • 'Saved Application State/com.apple.Preview.savedState'

DO NOT OPEN PREVIEW BEFORE LOGGING OUT WITHOUT PERSISTANCE AND RESTARTING.

Now, do a complete shutdown of your system, bring it back up. This fixes most non-critical issues with Preview.app. Make sure that when you shutdown, the box is not checked "remember my open programs."

If these steps do not solve the problem, assuming you are not running cracked or unauthorized software, you should reinstall OSX or seek professional help from an Authorized Apple Support center, because the problem is quite unusual and could be serious.

2
  • Wow. I have no idea if this is going to work or not but I'll definitely try ASAP. Thanks so much
    – Hinton
    Commented Aug 5, 2016 at 21:13
  • I used dtrace/dtruss to diagnose and fix my crashing Preview without rebooting, see my answer at StackOverflow.com/a/51264006/3008405
    – Devon
    Commented Nov 4, 2019 at 10:30

You must log in to answer this question.

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