Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I am trying to sign some code for an application. I can log into my Mac (Mountain Lion) and do this easily:

codesign -s "Developer ID Application: My Name" -f /path/to/appfile/mounted/elsewhere.app

'/path/to/appfile/mounted/elsewhere.app' is the path to the .app file which is actually hosted via Samba on another server.

However, if I ssh into the Mac and run the same command I get:

/path/to/appfile/mounted/elsewhere.app: replacing existing signature
libc++abi.dylib: terminate called without an active exception
Abort trap: 6

... and it fails. Here's the top of the crash report:

Process:         codesign [1353]
Path:            /usr/bin/codesign
Identifier:      codesign
Version:         0.3
Code Type:       X86-64 (Native)
Parent Process:  sshd [1352]
User ID:         501

Date/Time:       2012-08-01 11:06:50.092 +0100
OS Version:      Mac OS X 10.8 (12A269)
Report Version:  10

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Application Specific Information:
terminate called without an active exception
abort() called

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib              0x00007fff9980f212 __pthread_kill + 10
1   libsystem_c.dylib                   0x00007fff96de1b34 pthread_kill + 90
2   libsystem_c.dylib                   0x00007fff96e25dfa abort + 143
3   libc++abi.dylib                     0x00007fff92619f87 abort_message + 257
4   libc++abi.dylib                     0x00007fff92617944 default_terminate() + 42
5   libstdc++.6.dylib                   0x00007fff9249e527 std::terminate() + 18
6   com.apple.security                  0x00007fff8d898dfb Security::CodeSigning::SecCodeSigner::Signer::signMachO(Security::Universal*, Security::CodeSigning::Requirement::Context const&) + 1047
7   com.apple.security                  0x00007fff8d897e67 Security::CodeSigning::SecCodeSigner::Signer::sign(unsigned int) + 129
8   com.apple.security                  0x00007fff8d8957b9 Security::CodeSigning::SecCodeSigner::sign(Security::CodeSigning::SecStaticCode*, unsigned int) + 393
9   com.apple.security                  0x00007fff8d894a23 SecCodeSignerAddSignatureWithErrors + 52
10  codesign                            0x00000001096d0cca 0x1096ce000 + 11466
...

... I can post the rest if required.

What's stopping this working over SSH?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

I found that I needed to unlock the security keychain:

Mac-mini:~ gravelld$ security unlock-keychain
password to unlock default: 
Mac-mini:~ gravelld$ codesign -s "Developer ID Application: My Name" -f /path/to/appfile/mounted/elsewhere.app
/path/to/appfile/mounted/elsewhere.app: replacing existing signature
Mac-mini:~ gravelld$ 

Success! Hope this helps someone.

share|improve this answer
    
This answers half of the problem I had. The other half is - I'm trying to run this automatically as part of a build script. Is there a way to avoid being prompted for the password? –  Trejkaz Nov 21 '13 at 4:49
    
@Trejkaz It's bad but you can pass the password to security unlock-keychain using the -p switch. –  Dan Gravell Nov 21 '13 at 10:58
    
Yeah... that is pretty bad. I guess I'll just have to minimise it by putting it in a different keychain. –  Trejkaz Nov 21 '13 at 21:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.