Mac OS X application crashes, but only for one user. Why?
-
Fairly gnarly Mac debugging / troubleshooting question, concerning an app that crashes on launch consistently, but only when run by a single particular user. So far, it's stumped everyone. Lots of gory technical details inside. I have a Mac OS X application (Garmin's "VIRB Edit", which lets you download videos from the VIRB series of GoPro-ish cameras) that has turned into a slightly obsessive technical challenge. The problem is that it crashes immediately after launch, with absolute consistency, but only when run from a particular user's account, but not when run from a Guest account or from another user. So, obviously, the problem is related to that user's account/environment. But how to figure out what's doing it? When launched by the "bad" user, the application immediately quits with https://gist.github.com/kadin2048/9f5abcb107159c721b2a. The error that's causing the crash is setObjectForKey: object cannot be nil (key: LibraryPath)' terminating with uncaught exception of type NSException, and it's related to this part of the stack trace:8 libobjc.A.dylib 0x00007fff94225fa1 objc_exception_throw + 3439 com.apple.CoreFoundation 0x00007fff8a14a22e -[__NSDictionaryM setObject:forKey:] + 110210 com.garmin.VIRBEdit 0x000000010546b5a7 +[PreferencesViewController initDefaults] + 21211 com.garmin.VIRBEdit 0x000000010539b745 -[AppDelegate init] + 12412 com.apple.AppKit 0x00007fff8841f6f4 -[NSCustomObject nibInstantiate] + 36813 com.apple.AppKit 0x00007fff8841f520 -[NSIBObjectData instantiateObject:] + 30914 com.apple.AppKit 0x00007fff8841e815 -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 41315 com.apple.AppKit 0x00007fff884135ce loadNib + 32716 com.apple.AppKit 0x00007fff88412b6c +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 28817 com.apple.AppKit 0x00007fff8841295c -[NSBundle(NSNibLoading) loadNibNamed:owner:topLevelObjects:] + 19718 com.apple.AppKit 0x00007fff8841274b +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 35719 com.apple.AppKit 0x00007fff8840e597 NSApplicationMain + 44820 com.garmin.VIRBEdit 0x00000001053a8d90 main + 9521 libdyld.dylib 0x00007fff91a115fd start + 1My interpretation of this is that it's trying to load something from a NIB, possibly from a shared framework, and it's choking. But I'm open to other thoughts on what it might mean. When run from a Guest account or a different user's account, it launches just fine with no suggestion as to what might be going wrong. In fairness, I do have a lot of stuff installed (XCode and CLI tools, MacPorts, Homebrew, LaTeX, various releases of Python, etc.) but they are all installed for all users, not to the affected user's homedir. Things I have tried:Repair permissions - Just for starters, I ran Disk Utility's "Repair Permissions" a few times on the boot disk. It fixed a couple of things, but didn't appear to make a difference.Environment variables - On the theory that there's something going on with the "bad" user's $PATH, I copied/chowned .profile, .bash_profile, and .bashrc to the "good" user account, such that printenv shows the same variables set in each user's environment... and I get the same results. Program launches fine for one user, crashes for the other. So it doesn't seem to just be an environment var that's set on one side but not on the other. (Yeah, I really liked that theory, too.) N.B. I also moved/chowned ~/bin over, so they had access to the same stuff in the path, in addition to having the same $PATH set. User-specific Framework - Neither user has a ~/Library/Frameworks folder in their homedir, which would be the obvious place for a user-specific framework to be hiding. Though Apple's way of loading Frameworks seems rather complex, so maybe there is something else that can be eliminated?Preferences garbage - I tried copying (and chowning) the ~/Library/Application Support/Preferences folder from the "bad" account to the "good" account, thinking that perhaps there were some preferences causing the crash. Same result; after a logout/login on the "good" account side, the app still runs.Application Support garbage - Lacking other intelligent avenues, I tried copying the entire ~/Library/Application Support folder from the "bad" to "good" account, to see if that did anything. No dice.Run as another user with su - Here's where things get interesting. If, while logged in to OS X as the "bad" user, I open a shell and do either su - gooduser or su -m gooduser and then invoke the actual executable from the su'd shell, it launches cleanly in both situations. Since the difference between su - and su -m is whether it resets the environment, this seems to be further confirmation that it's not an environment/path issue. But—and here it gets weird—if I tell su to invoke the open command, then it crashes. In other words, the cleanest crash vs. no-crash setup I can get is this (in both situations I am logged into OS X as the "bad" user):Crash: su -m gooduser -c 'open /Applications/Garmin\ VIRB\ Edit.app'No Crash: su -m gooduser -c '/Applications/Garmin\ VIRB\ Edit.app/Contents/MacOS/Garmin\ Virb\ Edit'I don't know enough about Mac OS internals to know what the difference is between these two invocations, but the reason it's crashing seems to be something that https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/open.1.html does that a direct launch via the shell doesn't. Any Mac gurus want to weigh in?
-
Answer:
While I don't have the source code obviously, I do have a disassembler and a conference call less interesting than disassembling a random app. I need to wrap my head around this a little more, but in the meantime, make sure the user has a Movies folder in his home directory (it's there by default). Did he delete it somehow?
Kadin2048 at Ask.Metafilter.Com Visit the source
Other answers
Is there something funky (spaces somehow, special characters, etc...) about gooduser's actual username that isn't shared by other users?
zachlipton
Without having access to the source code, initDefaults is probably crashing on a bad NSUserDefaults dictionary, which is set per-user. Try deleting the defaults domain for the app and trying again: - Open Terminal and run "defaults read | grep garmin". It should find a dictionary, something like this: "com.garmin.xxxxx = { - Run "defaults delete com.garmin.xxxxx" replacing the string with whatever the actual match was.
perihare
The app is trying to find and/or create a directory at ~/Movies/Garmin (/Users/baduser/Movies/Garmin). Does that path exist? Are there strange permissions issues preventing baduser from accessing that path?
zachlipton
Try rebooting within the recovery partition. Open terminal and run resetpassword. On that screen is a button to reset the user permissions. (Disk Utility only fixes Apple's System folder)
Gungho
And no points to Garmin, because that is ridiculous behavior. posted by Kadin2048 at 3:27 PM on April 14 [+] [!] Microsoft Office will do the same shit if moved from where it wants to be. But then again that is to be expected of Microsoft.
Gungho
You may want to check preferences inside the .app - since .apps are basically folders, you may have permissions incompatible with your user in there... don't know how a situation like that would occur in the first place but it's the only thing that comes to mind... (Been a Mac admin for 7 years and was a certified tech before that...) That and the other solution, which admittedly is a little more drastic. Preserve the user's documents, delete the user, create a new user, transfer the documents back...
signsofrain
What happens if you login as gooduser and su to baduser to run the app?
primethyme
You may want to check preferences inside the .app Good thought. I ran sudo chmod -R a+rX on the application bundle; didn't seem to do anything. Everything seems to be rwxr-xr-x by root/admin. What happens if you login as gooduser and su to baduser to run the app? You get the 'reverse' behavior. Both su - baduser and su -m baduser, followed by trying to execute the binary inside the application bundle directly, cause a crash (it's the same setObjectForKey error that it always is). But if you run open /Applications/Garmin\ VIRB\ Edit.app/Contents/MacOS/Garmin\ VIRB\ Edit then it opens fine. Is there something funky (spaces somehow, special characters, etc...) about gooduser's actual username Nope. The "baduser" is all lowercase, same length as the "gooduser", and they're UIDs 501 and 504 respectively. Can't find anything notably different about them. Working on the defaults thing at the moment. (There are a bunch of defaults for "Garmin" that I'm trying to sort through; I do have some other legitimate Garmin software installed so I don't want to nuke it all accidentally.)
Kadin2048
I'd try what perihare suggests, or simply trashing (or moving/renaming) any likely looking preferences files in ~/Library/Application Support/Preferences and allowing the application to recreate them. The application is crashing when it tries to set up the preferences view, so it's presumably something in there. I'm unfamiliar with this particular application, but since it sounds like it's intended to interface with a plugged in GoPro it may be reading configuration or preferences files associated with the device, not just the actual application. You may want to see if you can track down anything that looks like that within the user's account, and move or delete it as well.
figurant
Related Q & A:
- How can I auto run ccleaner on Mac OS X?Best solution by forum.piriform.com
- How can I mount a network drive in Mac OS X in Java?Best solution by Stack Overflow
- Is it possible to compile Swift for OS X 10.5?Best solution by stackoverflow.com
- How to create a virtual file on mac OS X?Best solution by Super User
- What is the most functional Mac OS X all-in-one printer?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.