Fastlane is a powerful open-source tool that simplifies and automates the process of building, testing, and deploying iOS and Android apps. If you're an iOS developer looking to streamline your app deployment workflow, Fastlane is a must-have.
In this guide, I’ll walk you through installing Fastlane on macOS based on the official Fastlane iOS setup docs.
🔧 Prerequisites
Before starting, make sure you have:
- ✅ A Mac running macOS
- ✅ Xcode installed with command line tools
- ✅ Terminal and command-line basics
- ✅ A paid Apple Developer account (required for App Store deployment)
🛠 Step-by-Step Installation Guide
🥇 Step 1: Install Xcode Command Line Tools
Fastlane relies on Xcode's CLI tools for building/signing apps.
xcode-select --install
If already installed, you'll see a message. To confirm:
xcode-select -p
# /Applications/Xcode.app/Contents/Developer
🥈 Step 2: Install Fastlane
There are two common methods:
Option 1: Using RubyGems (Recommended)
sudo gem install fastlane -NV
-
sudo
: For admin privileges -
-NV
: Skips documentation for faster install
💡 Pro Tip: Use a
Gemfile
with Bundler for team projects:
# Gemfile
source "https://rubygems.org"
gem "fastlane"
Then run:
bundle install
Option 2: Using Homebrew
If you prefer Homebrew:
brew install fastlane
⚠️ Homebrew may lag behind RubyGems in version updates.
✅ Step 3: Verify the Installation
fastlane --version
# fastlane 2.x.x
⚙️ Step 4: Initialize Fastlane in Your iOS Project
cd /path/to/your/project
fastlane init
Choose an option:
- Option 2: Automate beta deployment to TestFlight
- Option 4: Manual setup
Fastlane creates a fastlane/
directory with:
-
Appfile
: Global config (e.g. Apple ID) -
Fastfile
: Automation workflows
💡 Prefer Swift? You can also use
Fastlane.swift
(still in beta).
🌐 Step 5: Configure Environment Variables (Optional)
For CI or locale issues, add this to your .zshrc
or .bashrc
:
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# Then reload:
source ~/.zshrc
🧯 Troubleshooting
-
Permission Errors: Use
sudo
when needed -
Missing CLI Tools: Run
xcode-select --install
-
Wrong Ruby Version: Use
rbenv
orrvm
-
Outdated Fastlane:
- RubyGems:
sudo gem update fastlane
- Homebrew:
brew upgrade fastlane
- RubyGems:
🤖 Why Use Fastlane?
Fastlane automates tedious iOS tasks:
- 📸 Screenshots (
snapshot
) - 🔐 Code signing (
match
) - 🚀 TestFlight/App Store uploads (
upload_to_testflight
) - 🧪 CI/CD integration
Example Lane
lane :beta do
increment_build_number
build_app
upload_to_testflight
end
Run it with:
fastlane beta
📚 Next Steps
Now that you're set up, explore:
- Automate screenshots
- Use
match
for signing - Configure TestFlight deployments
- Connect Fastlane with GitHub Actions, Jenkins, etc.
💬 Got questions or tips? Share them in the comments!
📎 Official docs: https://docs.fastlane.tools