-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to install helper with error: Error Domain=CFErrorDomainLaunchd Code=4 "(null)" #29
Comments
That error indicates SMJobBless failed. The most likely cause is that your app is sandboxed, which doesn't support privileged helper tools. So make sure you remove the sandbox capability from the host app in Xcode. That means you won't be able to put your app in the AppStore without getting special approval from Apple, which for security reasons, they are hesitant to grant. Also check that your helper tool has actually been copied into your app's bundle. Another thing that might help is to use the Swift script from my fork of this project instead of the shell script from this one. It does a couple of extra checks that the shell script doesn't do, but more importantly, it can actually emit error messages that show up in your build log. It's possible one of the extra checks may catch something, or that there are errors the shell script is catching but unable to emit errors for, because it's using stdout for string building. You can find it in the Scripts folder, along with its own README describing how to use it. |
@chipjarred can you explain a bit more about about how to remove the sandbox? |
@abstertee Regarding removing the sandbox, you do that by clicking on your project in Xcode's project navigator (side-bar on the left that shows files and folders). That will bring up your project settings in the editor view. In that view, select your main app's target, then click the "Signing & Capabilities" tab. By default a macOS app project will contain a signing section at the top followed by App Sandbox followed by Hardened Runtime. All the way on the right side of the editor view, across from App Sandbox there is little "x" you can click to remove the sandbox. Don't remove Hardened Runtime... you want that. Just remove App Sandbox. Now after rebuilding the app, it will run directly in macOS, not in a container. If there is no App Sandbox there, then its already removed. Just as a quick reminder, if you remove the sandbox, Apple won't allow your app in the App Store, so if this not just project for your personal use, you'll have to distribute it independently. As for checking that the helper tool has been copied to your app's bundle... As you probably already know, when you build your app, the actual executable binary is not the only thing Xcode builds. It creates a bundle, a special directory that appears as a file in the Finder, and places the executable binary inside of it along with other resources like storyboards, assets, etc... It has a specific folder structure. If your build is working correctly, your helper tool should be copied into that bundle as well. So to check if its there, you have to open the bundle, which means finding the built app. It's buried deep inside a bunch of build subfolders inside your Library folder, so the easiest way to do that is to right-click on the app's product in Xcode's project navigator, then select Show in Finder. Then in Finder right-click on the app and select "Show Package Contents". There should be a Library Folder containing LaunchServices folder. That's where your helper should be |
@chipjarred is the CodeSignUpdate.swift file supposed to only work with "Mac Developer" certs or can we use a "Developer ID Application" cert? |
@abstertee It's set up to work with func isValidDeveloperCN(_ s: String) -> Bool
{
let appleDeveloper = "Apple Development:"
let macDeveloper = "Mac Developer:"
if isValidDeveloperCN(s, withPrefix: appleDeveloper) { return true }
if isValidDeveloperCN(s, withPrefix: macDeveloper) { return true }
return false
} |
@chipjarred Either way I keep getting the following error with an SMJobBless check: |
@abstertee What follows involves editing your Info plists. I recommend using a plain text editor for this particular task rather than plist editor for this (so not Xcode). I'm using BBEdit, but you could use TextEdit, vi, emacs, whatever you like, as long as its showing the raw XML of the plist. Let's break down what you're getting from Helper Tool's Info.plistIf your project is based on this repo, this file is probably called Make sure the <key>CFBundleIdentifier</key>
<string>com.xxx.xxx.helper</string> and <key>CFBundleName</key>
<string>com.xxx.xxx.helper</string> Also delete the So the last few lines of your file should change from this <key>CFBundleVersion</key>
<string>1</string>
<key>SMAuthorizedClients</key>
<array>
<string>some certificate info here</string>
</array>
</dict>
</plist> to this <key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist> Save it Main
|
@abstertee Once you've gotten a working build, if you want to use a different certificate, you'll probably need to modify func isValidDeveloperCN(_ s: String) -> Bool
{
let appleDeveloper = "Apple Development:"
let macDeveloper = "Mac Developer:"
let customDeveloper = "Developer ID Application:" // <-- Add this for you to try
if isValidDeveloperCN(s, withPrefix: appleDeveloper) { return true }
if isValidDeveloperCN(s, withPrefix: macDeveloper) { return true }
if isValidDeveloperCN(s, withPrefix: customDeveloper) { return true } // <-- Add this too
return false
} I'll probably re-write that to use an array of prefixes to check in a loop instead of the straight sequential series of Although I think |
@chipjarred Thank you for the very detailed instructions. This was very helpful. What is the difference between the two certs and what is preventing us from using the "Developer ID Application" cert? I should add that this application is for internal use and will not be in the AppStore. |
I'm glad the instructions were helpful. As for why one certificate works and the other doesn't, I don't know. I wouldn't think a particular certificate would be a hard requirement for Of course, since the app has to run without a sandbox to use |
Hi @abstertee ,Sorry for resurrecting this thread, but I'm facing the same issue you mentioned. Despite initially working with a |
Failed to install helper with error: Error Domain=CFErrorDomainLaunchd Code=4 "(null)"
How to deal with this problem
The text was updated successfully, but these errors were encountered: