KISS

Keep It Simple Stupid

Jenkins and Xcode: "User interaction is not allowed"

| comments

Have you ever seen this message when building an Xcode project in Jenkins: "workspace/build/MyApp.app: User interaction is not allowed."?

This wiki page suggests clicking the ‘Always Allow’ button when asked. I would if I could.

Here’s how I’ve set it up. First, before an Xcode build step add an Execute shell step with the lines:

1
2
# unlock the keychain to make code signing work
security unlock-keychain ${HOME}/Library/Keychains/login.keychain

There is no password on that keychain, to ease the setup (http://stackoverflow.com/questions/577750/running-xcodebuild-from-a-forked-terminal/581002#581002). It should’ve done the trick, and it used to, but after a while the build process would fail.

Luckily, this post has directed me to the right track:

If you try ‘security show-keychain-info keychain-file’ then you’ll get the error “User interaction is not allowed”, and that’s a phrase to search with for some more info.

http://stackoverflow.com/questions/577750/running-xcodebuild-from-a-forked-terminal/579858#579858

When I tried that:

1
2
3
4
$ sudo su - jenkins
Password:
server:~ jenkins$ security show-keychain-info ~/Library/Keychains/login.keychain
security: SecKeychainCopySettings /Users/Shared/Jenkins/Library/Keychains/login.keychain: User interaction is not allowed.

Well, well, I’d expected that. Let’s unlock that first:

1
2
3
4
server:~ jenkins$ security unlock ~/Library/Keychains/login.keychain
password to unlock /Users/Shared/Jenkins/Library/Keychains/login.keychain:
server:~ jenkins$ security show-keychain-info ~/Library/Keychains/login.keychain
Keychain "/Users/Shared/Jenkins/Library/Keychains/login.keychain" lock-on-sleep timeout=300s

Behold: timeout=300s. It hit me that while the project is built by Jenkins, more than 5 minutes pass (due to the long process of JS&CSS compressing, but that’s another topic) and the keychain is locked again. We should fix that:

1
2
3
server:~ jenkins$ security set-keychain-settings -t 3600 -l ~/Library/Keychains/login.keychain
server:~ jenkins$ security show-keychain-info ~/Library/Keychains/login.keychain
Keychain "/Users/Shared/Jenkins/Library/Keychains/login.keychain" lock-on-sleep timeout=3600s

I’ve setup the timeout to 1 hour, which should be more than enough. Now there is no this issue anymore.

ps. Another Jenkins and Xcode related post is here: Jenkins, Xcode: “No matching provisioning profile found”.

Comments