How to unlock system keychain in OS X using terminal
<p>I have private key and certificate in system keychain and I want to access it using <em>CodeSign</em> so it needs to be unlocked.</p>

<p>if I try to unlock login keychain using below script then no problem </p>

<pre><code>security unlock-keychain -p password login.keychain
</code></pre>

<p>But If I use the same syntax for system.keychain then I get this error <em>security: SecKeychainUnlock The user name or passphrase you entered is not correct.</em></p>

<pre><code>security unlock-keychain -p password /Library/Keychains/System.keychain
</code></pre>

<p>From this what I can see there is no way to enter username in the syntax.</p>

<p>My intention is to <em>unlock the keychain</em> while <em>code-signing</em> the build,so that I won't get prompt like below.In the case of code-signing event in jenkins I'd get error like "<em>User Interaction is not allowed</em>"</p>

<p>I know this problem can be solved by giving access to all apps in keychain But I intend to do it via script itself.</p>

<p><a href="https://i.stack.imgur.com/MgXf9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/MgXf9.png" alt="code sign alert"></a></p>

<p>Any help is appreciated !</p>