# Command CodeSign failed with a nonzero exit code (errSecInternalComponent / resource fork, Finder information not allowed)

**Code:** `Command CodeSign failed` · **Category:** iOS · **Seen on:** iOS

codesign failed — the keychain is locked (CI/SSH), the private key is inaccessible, or files carry extended attributes that can’t be signed.

## Meaning

errSecInternalComponent means the keychain or key wasn’t accessible (locked keychain over SSH/CI). “resource fork, Finder information, or similar detritus not allowed” means extended attributes on files in the bundle (from downloads/Dropbox).

## Common causes

- Keychain locked (CI, SSH session)
- Private key access not allowed for codesign
- Extended attributes on bundle files
- Certificate expired/revoked

## Quick fix

1. Unlock the keychain before building (CI) and allow codesign access
2. Strip extended attributes: xattr -cr
3. Renew the certificate

## Detailed fix by platform

### Shell

1. 

```swift
security unlock-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" build.keychain
xattr -cr MyApp/
```


## How to diagnose

1. **Message** — errSecInternalComponent or detritus?
2. **Keychain** — Locked?
3. **Certificate** — Valid?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/ios/command-codesign-failed)
