- you have some prior knowledge about codesigning an iOS app
- you have an Apple developer account, enrolled in the Developer program (you have access to iTunes Connect)
- Mac OS 10.9 or newer with XCode installed
- Ruby 2.0 or newer (check
Codesigning and deploying an app to the Apple Store is a fastidious, time-consuming, error-prone process.
See this entry in Stack-Overflow just to get an idea. ;)
Don't worry, here comes Fastlane!
Fastlane is a toolbox (written in Ruby) that will allow you to automate all these tedious process.
You need the Xcode command line tools set up
If you have not used the command line tools before, you'll need to accept the terms of service.
sudo xcodebuild -license accept
Install the gem and all its dependencies (this might take a few minutes).
sudo gem install fastlane --verbose
Don't worry if it takes a few minutes. A lot of goodness is installing.
Try it out
You now have access to a lot of tools, called actions.
An action is designed to help you automate a single task.
For instance, let's try the action
Run anywhere in a terminal:
You will be prompted for your Apple Id and password.
Fastlane will use its credentials manager to store it in your keychain.
cert is automatically checking installed certificates on your machine
and creating one if it couldn't find any.
Now try to run:
You will be asked for a bundle identifier. Try to give one you've already used.
sigh is automatically creating/downloading provisioning profiles from your
developer account for the specified app.
There is a lot of useful actions bundled up in Fastlane.
produce is used to create an App Id in the developer member cender and/or iTunes Connect.
cert is used to create certificates.
sigh is used to manage provisioning profiles
gym is used to build and archive your app.
pilot is used to upload an ipa to testflight
deliver is used to manage the metadata on iTunes Connect.
pem is used to manage your push notification profiles
And there are many more! You'll see them all if you run:
If want to know more about a specific action, you can run:
fastlane actions [action]
or you can check the docs.
Orchestrate the magic in lanes
Now, what you'd probably want to do is put some of these actions together in a process.
For instance, to deploy an app to Testflight from scratch, you'd need to have a certificate, a provisioning profile. Then you'd archive your app and finally you'd upload it to Testflight.
Your process would be
gym and then
Well, with Fastlane, you can put actions together in a lane.
In a folder where you have an Xcode project, run:
$ fastlane init
It will create your app on the Apple developer portal and on iTunes Connect,automatically! It is actually using the action
produce to do so.
It will also generate a
fastlane folder with an
Appfile and a
Appfile stores useful information that are used across all
fastlane tools like your Apple ID or the application Bundle Identifier, to deploy your lanes faster and tailored on your project needs.
Find out more in the docs
Fastfile, you can create lanes, to orchestrate all the actions you'd want to use.
For instance, you could define:
lane :beta do # Put any actions you'd want here, for instance: # Use cert to generate a certificate cert # Use sigh to download or generate a provisioning profile sigh # Use gym to archive your app gym # Use pilot to upload your app to testflight pilot(distribute_external: false) end
$ fastlane beta
and let the magic happen!