If you have overseen the development for a relatively active iOS app, you might already know how often an app needs to be updated. Apple has tried to improve this process for the developer with continuous updates to XCode, but it is still a gross underestimation to even call the process tedious. fastlane is a command line tool to automate all the tasks for app deployment. Given the plethora of tasks that it handles, it’s amazing how easy it is to set it up.
I have overseen the development of several apps including several that were picked up from other developers and it still amazes me how many of them go without fastlane.
fastlane has a very good onboarding page to allow you set up fastlane for your app. Make sure you check that page out if you are starting out. But if you are anything like me and you just want to dive into it, this post is for you.
Installation is really simple. Use any of the following two:
$ brew install fastlane
$ sudo gem install fastlane -NV
First step is to run
fastlane init from the project directory that will generate the initial fastlane configuration for your project. The most interesting files are
Appfile, both in
Let’s start with the configuration of
Appfile. It contains configuration to identify your app. It could be left empty, but more often than not you would like to have the following options:
app_identifier "in.sapandiwakar.app" # The bundle identifier of your app
apple_id "email@example.com" # Your Apple email address
team_id "1234567890" # Developer Portal Team ID
itc_team_name "Team" # Team name on iTunesConnect. Redundant if team_id is defined
for_lane 'staging' do
To set up multiple package names for different lanes, use
for_lane with a block for configuration as above.
Fastfile is the one that is more involved. It contains instructions for fastlane to build and deploy your app (there are many more options, but let’s start with simple ones). Let’s add a
beta lane to
Fastfile that creates an ipa using
gym and uploads it to app store using
desc "Submit a new Beta Build to Apple TestFlight"
desc "This will also make sure the profile is up to date"
lane :beta do
ipa = gym(
scheme: "AppScheme", # Change scheme name (can be ignored if you only have single scheme)
pilot(ipa: ipa, skip_waiting_for_build_processing: true)
fastlane beta and it should build your app and submit to app store.
You can even post a message to
slack after publishing the build. Just add
slack(message: "Successfully distributed a new beta build") as the last line of your lane.
If you use Crashlytics instead of TestFlight for distributing the builds, you can use the following instead of
pilot in the above lane.
Check out fastlane docs for all the possible options for configuring fastlane.