2

I'm using Fastlane one my admin account (Mac OS) and it works great.

I try now to install and configure Jenkins + Fastlane but when jenkins try to run a fastlane commande, I get that error : can't find gem fastlane (>= 0.a) with executable fastlane (Gem::GemNotFoundException)

Path of my fastlane install is : /Users/myusername/.rvm/rubies/ruby-2.4.2/bin

When I try to update fastlane in jenkins account (su jenkins), console say I'm not sudo. No error with my account.

Already tried to inject Path in jenkins conf and to set RVM-managed environment version. But it failed.

Florian Mac Langlade
  • 1,863
  • 7
  • 28
  • 57
  • Does the Jenkins user also have it's own `.rvm`? We use `rbenv`, and we make sure that the Jenkins user has that installed and setup on all our Mac CI nodes. I have Jenkins `bundle install` in the project directory before it tries to run `fastlane` to make sure it has everything that it needs. Is that something you can do? – Lyndsey Ferguson Feb 14 '18 at 16:26
  • Are you running Jenkins with myusername or jenkins user? If the latter, he won't be able to reach your install directory. I would also suggest that you install fastlane in its default folder (/usr/local/bin). – Francois Nadeau Nov 13 '18 at 15:19

4 Answers4

5

Use anyone of below

Using RubyGems

sudo gem install fastlane -NV

Alternatively using Homebrew

brew cask install fastlane

See link for reference link

chank007
  • 240
  • 2
  • 8
  • I am getting error below while trying sudo gem install fastlane -NV ERROR: Failed to build gem native extension. – Qadir Hussain Jan 29 '20 at 09:59
  • Follow this link https://stackoverflow.com/questions/22544754/failed-to-build-gem-native-extension-installing-compass – chank007 Jan 30 '20 at 10:04
  • Just make sure Ruby installed on your machine. To install ruby use command "apt-get install ruby-dev" or follow this link https://gorails.com/setup/osx/10.15-catalina#ruby – chank007 Dec 24 '20 at 17:13
4

If you using pipeline in jenkins use sh 'gem install fastlane' it works fine.

kingston
  • 11,053
  • 14
  • 62
  • 116
Aravind
  • 105
  • 11
  • This does not help as on mac you have to use - sudo gem install fastlane and that is not the preferred way in CI pipeline environment. Ideally we should be able to set environment. – mobigaurav Aug 08 '21 at 21:00
1

This is what I did to fix a similar bug:

gem update bundler
belwood
  • 3,320
  • 11
  • 38
  • 45
Taras
  • 1,485
  • 1
  • 16
  • 31
1

For me all that needed to be done was rvm default and then reinstall what was needed, because for some reason it was installing for the older ruby version and not the newer one, so when it was accessing it on Jenkins, it was checking the new version which had nothing.