GitLab – FastLane – Apple M1 – can’t find gem cocoapods (>= 0.a)

 

I was getting the error:

[error] /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe’: can’t find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)

To fix this install cocoapods for the user:

 

First create a .bash_profile if it does not exist:

https://redfinsolutions.com/blog/creating-bashprofile-your-mac

 

Then remove cocoapods installation:

sudo gem uninstall cocoapods

Then install cocoapods as the user running the gitlab-runner:

Follow the “Sudo-less ” installation guide on:

https://guides.cocoapods.org/using/getting-started.html

 

Resources:

https://csiandal.medium.com/cant-find-gem-cocoapods-0-a-with-executable-pod-gem-gemnotfoundexception-94aa6dc8b630

GitLab – FastLane – Apple M1 -`initialize’: Permission denied @ rb_sysopen

I was getting the error:

 

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:1386:in `initialize’: Permission denied @ rb_sysopen – /Users/…/Library/MobileDevice/Provisioning Profiles/….mobileprovision (Errno::EACCES)

After

Installing provisioning profile…

 

It turns out I was using system ruby, so I followed this guide, to install rvm and use user installed ruby:

https://nrogap.medium.com/install-rvm-in-macos-step-by-step-d3b3c236953b

Ng is not available directly after a npm ci, when using gitlab and fastlane

In a .gitlab-ci.yml, I added a “script”:

 

build:

stage: build

script:

- npm ci


- npm run angular-build

 

 

angular-build, was defined in a pacakge.json as:

 

“scripts”: {

"angular-build": "ng build"

 

This would fail, because npm could not find ‘ng’.

I fixed this by adding a sleep between npm ci and npm run

 

build:

stage: build

script:

- npm ci


- sleep 5


- npm run angular-build