1. Macos Install Xcode From Terminal
  2. Install Xcode Using Terminal Key

I have installed Xcode and the command line tools from the Mac Developers website, which I have read a few times is a prerequisite. I also installed the MacPorts program. In terminal: sudo port install gcc48 sudo port select -set gcc mp-gcc48. All the above went smoothly until I type: hash gcc. I have installed Xcode and the command line tools from the Mac Developers website, which I have read a few times is a prerequisite. I also installed the MacPorts program. In terminal: sudo port install gcc48 sudo port select -set gcc mp-gcc48. All the above went smoothly until I type: hash gcc.

Setup Xcode for fastlane

Xcode command line tools (macOS)

Installing fastlane

fastlane can be installed multiple ways. The preferred method is with Bundler. fastlane can also be installed directly through with Homebrew (if on macOS). It is possible to use macOS's system Ruby but it's not recommended as it can be hard to manage dependencies and cause conflicts.

Managed Ruby environment + Bundler (macOS/Linux/Windows)

Ruby

If you use macOS, system Ruby is not recommended. There is a variety of ways to install Ruby without having to modify your system environment. For macOS and Linux, rbenv is one of the most popular ways to manage your Ruby environment.

fastlane supports Ruby versions 2.5 or newer. Verify which Ruby version you're using:

Bundler

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

  • Install Bundler by running gem install bundler
  • Create a ./Gemfile in the root directory of your project with the content
  • Run 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 bundle install as your first build step
  • To update fastlane, just run bundle update fastlane

Homebrew (macOS)

This way you don't have to install Ruby separately and instead homebrew installs the most adequate Ruby version for fastlane.See this page for details.

System Ruby + RubyGems (macOS/Linux/Windows)

This is not recommended for your local environment, but you can still install fastlane to system Ruby's environment. Using sudo often occurs unwanted results later due to file permission and makes managing your environment harder.

Setting up fastlane

Navigate your terminal to your project's directory and run

Note that if you want to create your first app on your App Store Connect account, you need to set the developer name (company_name) with PRODUCE_COMPANY_NAME environment variable:

Install Xcode Using Terminal

Macos Install Xcode From Terminal

To get more information check company_name description in the Create app documentation.

To have your Fastfile configuration written in Swift (Beta)

Swift setup is still in beta. See Fastlane.swift docs for more information.

Depending on what kind of setup you choose, different files will be set up for you. If you chose to download the existing app metadata, you'll end up with new folders that look like this:

Install Xcode Using Terminal

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 fastlane to generate screenshots, or automatically distribute new builds, and much, much more. Here're some examples:

  • Discover all fastlane actions

Do note that if the automation you're building requires connectivity with Apple's servers, such as for code signing when building your app, or uploading your app to the App Store Connect, and so on, you will need to authenticate. Check out Authenticating with Apple services to learn the best ways to authenticate, catered for your specific use case.

Set up environment variables

fastlane requires some environment variables set up to run correctly. In particular, having your locale not set to a UTF-8 locale will cause issues with building and uploading your build. In your shell profile add the following lines:

Install Xcode Using Terminal Key

You can find your shell profile at ~/.bashrc, ~/.bash_profile, ~/.profile or ~/.zshrc depending on your system.

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.

  • Create a ./Gemfile in the root directory of your project with the content
  • 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 fastlane