error: The specified item could not be found in the keychain.

During build process, I have been encountering an error "error: The specified item could not be found in the keychain." for the code signing process.

My apple ID joins a developer program of my company. I have 2 macbook - 1 for my personal, and 1 for my company. I can build apps with my personal macbook, but failed with my company one. I have exported the developer account from xcode of my personal macbook, and also imported to the company macbook's xcode.

Both macbooks are macOS Monterey, and both xcode are the same version 13.2.1

For building an app, I've chosen "Automatically manage signing"

And the certs and keys are separate, don't know why not shown in pairs

On the Mac that’s having problems, what does the following print?

% security find-identity -p codesigning -v

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

OK, that’s not good )-:

In your screen shot I noticed that you have Certificates selected at the top. This, combined with the results from find-identity, suggest that you have copied across these signing certificates but not their matching private keys. Thus you have signing certificates but not signing identities.

If you don’t understand the difference — and, trust me, you’re not the only one, our industry is plagued by this problem — read Certificate Signing Requests Explained for the backstory.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I’ve tried to copy cert and key by exporting from my personal MacBook

This should work. The trick is to export the digital identity as a .p12 file. See this post for specific instructions.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

the cert and key still not in My Certificate tab, but Certificates tab and Keys tab separately.

Hmmm, it’s true that Keychain Access has its fair share of bugs. I know this sounds stupid, but did you try quitting and relaunching it?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Do you know if we can re-install the keychain access?

No. Keychain Access is built in to the OS and, assuming you didn’t go out of your way to disable SIP, can’t be modified.

Just for testing purposes, create a new user account on your Mac (using System Preferences > Users & Groups), log is as that user, and then import the .p12 there. What happens?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Good idea to have a try! Unfortunately, after a try... The below is my new account on the same macbook and after double-clicked the .p12 file....

Are you sure that this is actually a PKCS#12 file? What does this print:

% file /path/to/my.p12

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

it prints: /path/to/my.p12: data

OK, that’s what I was expecting.

So, it works in my personal macbook pro (the source), App Center for building app, my old macbook Air, but my company's macbook pro....

Are you missing a “not” in that last clause?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

not working in my company's [Mac]

I recommend that you escalate this via your company’s IS department.

Importing a digital identity into a keychain should work, and we know it works on your personal machine. Moreover, the fact that it fails when you use a fresh user account means that there’s no lingering configuration issue on your main user account. All that remains is a configuration issue with the Mac itself, and that’s not something I can help you with [1].

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] My experience is that companies often install ‘security’ software that causes all sorts of weird and wonderful problems. The obvious next step here is to disable that software, but I’m not going to advise you to do that without talking to your IS department first.

Thx. I just had the same problem for the first time. Can't create a new signing request :(

I have the similar situation on my mac-mini now (Feb, 2024, Sonoma 14.3.1). I have several records for testflight in my keychain. And old records work well. But a new record (I created it today) doesn't work. I have these messages:

dmitriy@Mini-Dmitriy IPA % xcrun altool --upload-app --type ios --file app.ipa --username dmitriy@<mydomain>.com --password @keychain:TESTFLIGHT_PROD --verbose
2024-02-24 17:16:24.810 Starting altool... 2024-02-24 17:16:24.813 Initializing bundle from: /Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/Frameworks/AppStoreService.framework 2024-02-24 17:16:24.819 Will look for transporter at executable bundle relative path: /Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/itms/bin/iTMSTransporter 2024-02-24 17:16:24.819 Looking for Transporter at path: /Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/itms/bin/iTMSTransporter 2024-02-24 17:16:24.819 Looking for Transporter at path: /Applications/Xcode.app/Contents/Developer/usr/bin/../SharedFrameworks/ContentDeliveryServices.framework/itms/bin/iTMSTransporter 2024-02-24 17:16:24.819 Looking for Transporter at path: /Applications/Xcode.app/Contents/Developer/usr/bin/../itms/bin/iTMSTransporter 2024-02-24 17:16:24.819 Looking for Transporter at path: /Applications/Transporter.app/Contents/itms/bin/iTMSTransporter 2024-02-24 17:16:24.819 Looking for Transporter at path: /usr/local/itms/bin/iTMSTransporter 2024-02-24 17:16:24.819 Using default transporter location: /usr/local/itms/bin/iTMSTransporter 2024-02-24 17:16:24.820 Verbose logging enabled. 2024-02-24 17:16:24.833 *** Error: Failed to read legacy keychain item 'TESTFLIGHT_PROD', Error Domain=ITunesConnectFoundationErrorDomain Code=-25300 "The specified item could not be found in the keychain." UserInfo={NSLocalizedDescription=The specified item could not be found in the keychain., NSLocalizedFailureReason=The specified item could not be found in the keychain.} 2024-02-24 17:16:24.833 *** Error: altool encountered an error. 2024-02-24 17:16:24.833 *** Error: The specified item could not be found in the keychain. (-25300)

And, of course, I have a valid application key. It works without @keyachain well.

error: The specified item could not be found in the keychain.
 
 
Q