0

My application requires a dylib file to be in /usr/lib/. If it is not there, the application copies the dylib to /usr/lib/ from the application resources directory. To do this, I use a helper tool, which calls /usr/bin/sudo.

Although this application works correctly on many systems, I've just received a bug report where the application apparently cannot find the launch path of the helper tool.

Does anyone have any ideas why this would work on many systems, but break on just one?

The code:

if (!libraryExists) {
    NSLog(@"dylib does not exist at usr/lib. Launching helper tool to duplicate dylib in application directory\n");         
    NSArray *args = [NSArray arrayWithObjects:helperToolPath, @"setup", nil];
    [NSTask launchedTaskWithLaunchPath:helperToolPath arguments:args];  
}

The log:

2012-01-11 09:53:59.008 Application[1860:b07] Path of helper tool set to: /Users/xx/Downloads/Application.app/Contents/Resources/HelperTool

2012-01-11 09:54:00.585 Application[1860:b07] dylib does not exist at usr/lib. Launching helper tool to duplicate dylib from application directory

2012-01-11 09:54:00.587 Application[1860:b07] launch path not accessible

JimmyB
  • 326
  • 3
  • 12
  • Why not put the dylib in `Application.app/Contents/Frameworks` and link to it there? – mipadi Jan 12 '12 at 18:53
  • i would love to do that! unfortunately i dont know how to tell dyld to search for the dylib in Application.app/Contents/Frameworks, rather than /usr/lib. Or have I missed something fundamental? – JimmyB Jan 17 '12 at 01:40

1 Answers1

1

If the user is not in the admin group, they might not have permission to run your helper app. You can create a new user account without admin privileges to test this theory.

Mark F
  • 457
  • 2
  • 6
  • thanks for the suggestion. i will ask the user to try running the program with an admin account. thank you! – JimmyB Jan 12 '12 at 03:52
  • i was able to reproduce his problem on a test account without administrator rights. the problem is that the helper app is not appearing as a unix executable file... chmod +x on the helper app solved the problem, but obviously i dont want to tell users to do this! do you have any idea why the file would appear as a unix executable on my computer but not on his? – JimmyB Jan 12 '12 at 05:05
  • It sounds like the permission on that file are set to something like 750, where the owner and admin group can execute it, but not "anyone". You'll need to make it executable by anyone in order to open your helper app, or check out "BetterAuthorizationSample" sample code for a way to launch it with privileges. (And check out Authorization Services documentation, which talks about helper apps specifically). – Mark F Jan 12 '12 at 05:13
  • as it turns out, it was a permissions issue. however, it was originating from that the fact that dropbox was stripping the permissions on my files... http://stackoverflow.com/questions/8830479/cocoa-application-wont-run-because-contents-macos-application-is-not-a-unix-exe thanks very much for your help! – JimmyB Jan 12 '12 at 05:55