MacOS – Terminal “open” any image results in “Preview quit unexpectedly”

findermacospreviewterminal

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.

Best Answer

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.