New to fastlane? Click here to open the installation & setup instructions first

1) Install the latest Xcode command line tools

xcode-select --install

2) Install fastlane

# Using RubyGems
sudo gem install fastlane -NV

# Alternatively using Homebrew
brew install fastlane

3) Navigate to your project and run

fastlane init

More Details

Appfile

The 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.

The Appfile has to be inside your ./fastlane directory.

By default an Appfile looks like:

app_identifier "net.sunapps.1" # The bundle identifier of your app
apple_id "felix@krausefx.com"  # Your Apple email address

# You can uncomment the lines below and add your own
# team selection in case you're in multiple teams
# team_name "Felix Krause"
# team_id "Q2CBPJ58CA"

# To select a team for App Store Connect use
# itc_team_name "Company Name"
# itc_team_id "18742801"

If you have different credentials for App Store Connect and the Apple Developer Portal use the following code:

app_identifier "tools.fastlane.app"       # The bundle identifier of your app

apple_dev_portal_id "portal@company.com"  # Apple Developer Account
itunes_connect_id "tunes@company.com"     # App Store Connect Account

team_id "Q2CBPJ58CA" # Developer Portal Team ID
itc_team_id "18742801" # App Store Connect Team ID

If your project has different bundle identifiers per environment (i.e. beta, app store), you can define that by using for_platform and/or for_lane block declaration.

app_identifier "net.sunapps.1"
apple_id "felix@krausefx.com"
team_id "Q2CBPJ58CC"

for_platform :ios do
  team_id '123' # for all iOS related things
  for_lane :test do
    app_identifier 'com.app.test'
  end
end

You only have to use for_platform if you're using platform [platform_name] do in your Fastfile.

fastlane will always use the lane specific value if given, otherwise fall back to the value on the top of the file. Therefore, while driving the :test lane, this configuration is loaded:

app_identifier "com.app.test"
apple_id "felix@krausefx.com"
team_id "123"

Accessing from fastlane

If you want to access those values from within your Fastfile use

identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
team_id = CredentialsManager::AppfileConfig.try_fetch_value(:team_id)