After I have upgraded both Xcode (to 6.0.1) and OS X Server (to 3.2.1) I can\'t figure out how to add certificates for the provisioning profiles so the Xcode bot can find th
When you export a .p12 file Keychain Access will ask you for a password. Try adding the password for the p12 file to your command. Like so,
sudo security import "/Users/administrator/Desktop/Greener Pastures Enterprise Distribution TEST Certificate.p12" -P PASSWORD -k /Library/Developer/XcodeServer/Keychains/Portal.keychain -A -T /usr/bin/codesign -T /usr/bin/xcodebuild -T /usr/bin/pkgbuild
I have a script on our build server that imports p12 files from a drop off folder. The import line looks like this:
security import $_ -k /Library/Developer/XcodeServer/Keychains/Portal.keychain -P PASSWORD -A
If you had it working with the old osx server and xcode 5. You just do:
$ mv /Library/Developer/XcodeServer/Keychains/Portal.keychain /Library/Developer/XcodeServer/Keychains/Portal.keychain.bkp
$ ln -s /Library/Keychains/System.keychain /Library/Developer/XcodeServer/Keychains/Portal.keychain
The old server used the system keychain.
For OX X Server 4.0 and XCode 6.1 is a much easier way:
Open your Project with XCode on the Server add your Developer Account to "Accounts" and download all required provisioning profiles.
Copy your Privisioning Profiles from /Users//Library/MobileDevices/Provisioning Profiles/ into /Library/Developer/XcodeServer/ProvisioningProfiles/
Give read and write access for administrators for the folder /Library/Developer/XcodeServer/ProvisioningProfiles/
Open KeyChaine Access double click on the provisioning profile keys (for example iOS Developer: XY) and allow access for all apps.
Done.
I had the same issue. I fixed it through the following methods :
Xcode > Preferences > Accounts > View Details > And just refresh the Provisioning Profile
Then Restart the Xcode and Clean & Build.
Try to add your server to the developer portal first and remove all restrictions like explicit provisioning files from your project.
If this doesn't work, file a Radar explaining your configuration and why you think it should be supported by Apple.
If you are really, really sure it's a good idea to hack your server, possible breaking it, open a terminal on your server from an account with administrator privileges and:
Copy the Portal keychain to your desktop:
> sudo cp /Library/Developer/XcodeServer/Keychains/Portal.keychain ~/Desktop/
Password:
your-administrator-password
> sudo chown `whoami`:staff ~/Desktop/Portal.keychain
Set the Portal keychain password to “123”
> security set-keychain-password -o "`sudo cat /Library/Developer/XcodeServer/SharedSecrets/PortalKeychainSharedSecret`" ~/Desktop/Portal.keychain
New Password:
123
Retype New Password:
123
Open the Keychain in Keychain Access:
> open -b com.apple.keychainaccess ~/Desktop/Portal.keychain
Unlock the “Portal” keychain using password “123”
Copy the needed keys from your personal “login” keychain to the “Portal” keychain.
Make sure the private keys have the right access rights (in the “Access Control” tab), “xcsbuildd”, “xcscontrol”, “xcodebuild” and “codesign” should be listed
Lock the “Portal” keychain, quit “Keychain Access”
Reset the Portal keychain password:
> security set-keychain-password -p "`sudo cat /Library/Developer/XcodeServer/SharedSecrets/PortalKeychainSharedSecret`" ~/Desktop/Portal.keychain
Password:
your-administrator-password (optional step)
Old Password:
123
It may or may not ask you for your administrator password again, pay attention to the prompt.
Copy the Portal keychain back
> sudo chown _xcsbuildd:_xcs ~/Desktop/Portal.keychain
> sudo cp ~/Desktop/Portal.keychain /Library/Developer/XcodeServer/Keychains/
Since the system caches open keychains, restart you computer.
Don't just blindly copy keys to the Portal keychain. Try other solutions first and ask on stack overflow if you need help. Only follow this procedure after filing a Radar, not just because “things don't work”. You will destroy your system when you are not exactly sure what you're doing here.
Copy the following script as importP12.sh
:
#!/bin/sh
importP12()
{
P12FILE="$1"
XCS="/Library/Developer/XcodeServer";
XCBIN="$XCS/CurrentXcodeSymlink/Contents/Developer/usr/bin";
PORTALKC="$XCS/Keychains/Portal.keychain"
PORTALKCS="$XCS/SharedSecrets/PortalKeychainSharedSecret"
sudo security -i <<IMPORT
unlock-keychain -p "`sudo cat $PORTALKCS`" $PORTALKC
import "$P12FILE" -k $PORTALKC -T "$XCBIN/xcsbuildd" -T "$XCBIN/xcscontrol" -T "$XCBIN/xcodebuild" -T /usr/bin/codesign
lock-keychain $PORTALKC
IMPORT
}
echo "Please enter your account password:"
for p12 in "$@"
do
importP12 "$p12"
done
And do
> importP12.sh
your-P12-file.p12
Password:
your-administrator-password
A dialog asking you for the P12 import password should appear and you are set.
This answer from Matt Moriarity brought me to a solution: https://devforums.apple.com/message/1022214#1022214
I just re-connected the build server with our development team. This made the Xcode-service to re-initialize all certificates and provisioning profiles it needs. Now the integration builds run without errors.
In Server > Xcode > Settings > Builds > Development Teams click on Edit...
Remove your development team(s) from the list and press OK
After ther Server.app finished its work, there should be no entry behinde "Development Teams" and the list of devices is also empty.
Now open Server > Xcode > Settings > Builds > Development Teams > Edit... again and add your development team
After your team and devices re-appeared, you can start the integration build
It's important not to use your own provisioning profiles. Take the "iOS Developer (Automatic)" setting.