Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SMJobBless causes kSMErrorDomainFramework error 5 - The tool at the specified path is not valid

Running SMJobBless:

(PrefPane project xcode version 4 Build 4A304a)

SMJobBless(kSMDomainSystemLaunchd, @"com.coderama.coderamaHelper", authRef, &err);

Causes this error:

System Preferences[22312:903] Bless Error: Error Domain=kSMErrorDomainFramework Code=5 UserInfo=0x2005790e0 "The operation couldn’t be completed. (kSMErrorDomainFramework error 5 - The tool at the specified path is not valid.)"

Below are my plists.

Can anyone decipher the error message so I can attempt to troubleshoot this? I have gone over all of my plists to make sure the names match-up.

coderama-info.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundleExecutable</key>
    <string>${EXECUTABLE_NAME}</string>
    <key>CFBundleIconFile</key>
    <string></string>
    <key>CFBundleIdentifier</key>
    <string>com.coderama.${PRODUCT_NAME:rfc1034identifier}</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>${PRODUCT_NAME}</string>
    <key>CFBundlePackageType</key>
    <string>BNDL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1.0</string>
    <key>NSHumanReadableCopyright</key>
    <string>Copyright © 2012 coderama. All rights reserved.</string>
    <key>NSMainNibFile</key>
    <string>coderama</string>
    <key>NSPrefPaneIconFile</key>
    <string>show_wireframe_zoom_24.gif</string>
    <key>NSPrefPaneIconLabel</key>
    <string>coderama</string>
    <key>NSPrincipalClass</key>
    <string>coderama</string>
    <key>SMPrivilegedExecutables</key>
    <dict>
        <key>com.coderama.coderamaHelper</key>
        <string>identifier com.coderama.coderamaHelper and certificate leaf[subject.CN] = &quot;Joe Developer&quot;</string>
    </dict>
</dict>
</plist>

coderamaHelper-info.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleIdentifier</key>
    <string>com.coderama.coderamaHelper</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>coderamaHelper</string>
    <key>CFBundleVersion</key>
    <string>1.0</string>
    <key>SMAuthorizedClients</key>
    <array>
        <string>identifier com.coderama.coderama and certificate leaf[subject.CN] = &quot;Joe Developer&quot;</string>
    </array>
</dict>
</plist>

coderamaHelper-Launchd.plist looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.coderama.coderamaHelper</string>
    <key>MachServices</key>
    <dict>
        <key>com.coderama.coderamaHelper.mach</key>
        <true/>
    </dict>
</dict>
</plist>
like image 285
Coderama Avatar asked Mar 03 '12 13:03

Coderama


3 Answers

I went to this error too, at first check again the steps declared in the readme.txt of the SMJobless project:

  1. In the application go to: Target/Build Phases /Copy Files and make
    sure that the parameters are correctly assigned: Destination = wrapper,
    subpath = Contents/Library/LaunchServices, and finally load the
    daemon or service into the project.
  2. In the application go to the file info.plist and check for the following key :"Tools owned after installation" and set it up to=
    identifier com.acme.MyService and certificate leaf[subject.CN] =
    "MyCertificate" . You must replace MyService and MyCertificate by
    your own ones.
  3. In the helper tool or daemon go to info.plist file. Here you have to add some key/value pairs, the first one is: "Clients allowed to add and remove tool" which must be set to "identifier
    com.acme.MyApp and certificate leaf[subject.CN] = "MyCertificate"
    ,remember replace MyApp and MyCertificate by your own ones.
  4. Finally make sure that THE DAEMON is embedded in the executable itself before Build it, this is accomplished by this way: In the helper tool or daemon go to target/Build Settings/Linking/Other Linker Flags and add the following:

    -sectcreate
    __TEXT
    __info_plist
    MyDaemon/info.plist
    -sectcreate
    __TEXT
    _launchd_plist
    MyDaemon/myDaemon-launchd.plist

Make sure to replace MyDaemon for the correct values of your own development. Be careful with the names of your info and launchd files.

IMPORTANT TIP: THE NAME OF THE DAEMON OR SERVICE MUST CORRESPOND TO THE SAME NAME WRITTEN IN THE INFO.PLIST AND LAUNCHD.PLIST FILES OTHERWISE IT WILL GENERATE THE ERROR kSMErrorDomainFramework error 5 - The tool at the specified path is not valid.

like image 75
willyMon Avatar answered Oct 27 '22 01:10

willyMon


An Apple developer replied to me stating that SMJobBless only works with Applications only.

like image 25
Coderama Avatar answered Oct 26 '22 23:10

Coderama


This error occurs when the helper tool is not bundled in the correct location, and so SMJobBless() can't find the tool for installation. In the Build Phases section of your main application target, you have to add a Copy Files build phase. Add your helper tool, set the destination to Wrapper and the subpath to Contents/Library/LaunchServices, and SMJobBless() will be able to find your helper tool.

like image 28
Itai Ferber Avatar answered Oct 26 '22 23:10

Itai Ferber