Maintaining Xcode on a CI server has always been a hassle.
Over the past we suffered through different solutions, from connection via VNC and updating Xcode with the Mac App Store, to manually downloading Xcode from the Developer Portal.

Luckily there is a RubyGem Xcode-Install to install/update Xcode, and has a comfortable fastlane integration. (We will cover more of fastlane very soon 😉 )

Xcode lane

For our projects we created a lane to update Xcode locally and on CI servers:

 

So we can pass the version as a parameter:
Update Xcode with parameter
If not, we get the prompt:
Update Xcode with prompt

Jenkins Integration

As we already using Jenkins for our other builds, I wanted to create a job for updating Xcode as well.
The only problem, the xcode-install gem requires the user-password during the installation.

I thought of several solutions, but all of them don’t sound really secure:

  • Run Jenkins as root user
  • Allow sudo without password prompt

In the end I found a better solution. It’s possible to pipe the password into sudo and execute fastlane:

 

Now we can update Xcode in Jenkins:
Update xcode job

 

Leave a Comment

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close