Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fastlane uses wrong cocoapod version

When using fastlane and cocoapods to build our iOS app I noticed that fastlane does not use the version of cocoapods that I have installed using

sudo gem install cocoapods

When running

pod --version

it returns the latest version which is of this moment

1.3.1

However, when running a build lane in fastlane it uses cocoapods version 1.2.1 for some reason.

I use this in my Fastfile to clean and pod install

  cocoapods(
    clean: true,
    podfile: "Podfile"
  )

Is there a way I can tel fastlane to use a specific version of cocoapods? Or use the version I have installed manually?

like image 596
JorgeDeCorte Avatar asked Oct 24 '17 16:10

JorgeDeCorte


People also ask

What is the latest version of CocoaPod?

1.11. 3 - March 16, 2022 (287 KB)

How do I specify pod version in Podfile?

<Specifying pod versions Later on in the project you may want to freeze to a specific version of a Pod, in which case you can specify that version number. Besides no version, or a specific one, it is also possible to use logical operators: '> 0.1' Any version higher than 0.1. '>= 0.1' Version 0.1 and any higher version.

Does Cocoapods work on M1 Mac?

You should have Cocoapods running on your M1 Mac.


1 Answers

It's recommended to 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.

  • Install bundler using sudo gem install bundler
  • Create a ./Gemfile in the root directory of your project with the content:
source "https://rubygems.org"

gem 'fastlane'
gem 'cocoapods'
  • 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
like image 57
KrauseFx Avatar answered Oct 17 '22 21:10

KrauseFx