How to use a specific version of fastlane?

If you use our fastlane step to run your fastlane config, and you want to use a specific version of fastlane:

  1. Add a Script step right before the fastlane step
  2. Specify this as the content of the Script step:
set -ex
gem uninstall fastlane --all --executables
gem install fastlane --version 2.18.3 --no-document
  1. Make sure that the Should update fastlane gem before run? (update_fastlane) option of the fastlane step is set to false.

That’s all. Of course, replace 2.18.3 with the version you want to use :wink:

Using a Gemfile & Gemfile.lock: if you use our fastlane step this is mentioned in the description of the step:

If Gemfile exists in the work_dir directory, fastlane will be used by bundle install && bundle exec.

If you’re familiar with Ruby projects and with how the Gemfile & Gemfile.lock works this is probably the best solution, and it’s pretty much 0 effort.

But if you don’t use a Gemfile & bundle exec on your Mac to run fastlane then the Script based solution above is probably easier to maintain. Up to you of course, the step can work with either solution :wink:

Happy Building!

How to use always the latest version of fastlane?

  1. Make sure you don’t have a Gemfile & Gemfile.lock in your repository, or if you have to then make sure fastlane is not listed on either
  2. After this enable the Should update fastlane gem before run? option of the fastlane step (set it to true)

How to upgrade the preinstalled fastlane version (e.g. if you don’t use the fastlane step)?

Add a Script step to your Workflow, before fastlane would be used (can be the very first step of the workflow), with the content:

set -ex

gem install fastlane -NV

Hi There,
This regarding the maintaining same Fastlane version over the period of time. I mean can we install specific version as I see Fastlane gets new version everytime

Yes, see the initial post at the top here How to use a specific version of fastlane? :slight_smile:

hi viktorbenei,

i am new to the Fastlane, i am not getting what is the fastlane step here , and where we need to add a script to execute ,

i have installed ruby 2.2.0 and tried to install the fastlane with gem install fastlane 2.73.0, still it is installaning latest version fastlane .

can you explain in detail how to install specific version of fastlane ?

Do you mean on your own Mac? Or on

Did you follow the steps at :point_up: (How to use a specific version of fastlane?)

Make sure that the Should update fastlane gem before run? (update_fastlane) option of the fastlane step is set to false.

To update this thread, the script step does not always work. It might be specific to the Xcode 11.3.x on Mojave stack but executing “gem uninstall fastlane” will results to a failure as there are already some components dependent on it.

ERROR: While executing gem … (Gem::DependencyRemovalException)
Uninstallation aborted due to dependent gem(s)

Seeing the same issue on Xcode 11.4.x Catalina stack. Would love to get updated guidance on how to do this.

The way I worked around it is to find the usable version above the fastlane and gems that came with the image. For us it was 2.149.1 which worked for a while because that version was higher that the one in the image so we can “upgrade” rather installing from scratch.

Caveat that I said it worked for a while. Something changed in the gems since July 13 which is raising conflicts again. I was unable to find the conflicting package since the versions are identical prior to the mass-failure. I ended up upgrading to fastlane 2.152.0 which thankfully worked since the version that borked our builds was 2.150.0.

This is what I have in our workflows:

   - script@1:
       title: Execute fastlane override values.
       run_if: '{{getenv "FASTLANE_OVERRIDE_EXECUTED" | eq "" }}'
       - content: |
           #!/usr/bin/env bash
           set -e
           echo "[INFO] Setting the faslane version to 2.152.0  "
           gem install fastlane --version 2.152.0 --no-document
           #set the flag so this step will no longer execute if called again in
           # the same execution
           envman add --key "FASTLANE_OVERRIDE_EXECUTED" --value "true"