Getting started with fastlane for iOS

Installing fastlane

Make sure you have the latest version of the Xcode command line tools installed:

xcode-select --install

Choose your installation method:

Homebrew Installer Script Rubygems
macOS macOS macOS or Linux with Ruby 2.0.0 or above
brew cask install fastlane Download the zip file. Then double click on the install script (or run it in a terminal window). sudo gem install fastlane -NV

Setting up fastlane

Navigate your terminal to your project's directory and run

fastlane init

You'll be asked for your Apple ID, and fastlane will automatically generate a fastlane configuration for you, based on the information provided.

You can see the newly created fastlane directory, with all your existing metadata fetched from iTunes Connect.

The most interesting file is fastlane/Fastfile, which contains all the information that is needed to distribute your app.

What's next?

fastlane created all the required files for you, now you can go ahead and customise it to generate screenshots or to automatically distribute new builds

Use a Gemfile

It is recommended that you use a Gemfile to define your dependency on fastlane. This will clearly define the used fastlane version, and its dependencies, and will also speed up using fastlane.

  • Install bundler using sudo gem install bundler
  • Create a ./Gemfile in the root directory of your project with the content
source "https://rubygems.org"

gem "fastlane"
  • Run [sudo] bundle update and add both the ./Gemfile and the ./Gemfile.lock to version control
  • Every time you run fastlane, use bundle exec fastlane [lane]
  • On your CI, add [sudo] bundle install as your first build step
  • To update fastlane, just run [sudo] bundle update