You’ve got a newly installed macos Monterey machine you want to use as a gitlab-runner host to test and build your ios and macos projects on. What do you need?
macos command line tools
Get the macos Command Line Tools. In a terminal, run:
xcode-select --install softwareupdate -l # Then pick the most recent version of Command Line tools, e.g. softwareupdate --install "Command Line Tools for Xcode-13.3" sudo xcodebuild -license accept
Then install homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Brewfile (save it to
brew "asdf" brew "bash" brew "bash-completion" brew "ack" brew "autoconf" brew "automake" brew "coreutils" brew "curl" brew "gettext" brew "git" brew "gnu-sed" brew "gnu-tar" brew "gnu-indent" brew "gnu-which" brew "pkg-config" brew "robotsandpencils/made/xcodes"
in the same folder as the
cd ~ && brew bundle).
And get and install the latest Xcode so you have the ios simulator, etc:
XCODES_USERNAME="your_apple_id" XCODES_PASSWORD="your_apple_id_password" xcodes install --latest
Now install and configure the gitlab-runner:
# Install gitlab-runner # uses `arch` to fetch the correct version [ "$(arch)" = "i386" ] && sudo curl --output /usr/local/bin/gitlab-runner "https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-darwin-amd64" || sudo curl --output /usr/local/bin/gitlab-runner "https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-darwin-arm64" sudo chmod +x /usr/local/bin/gitlab-runner # Register the runner gitlab-runner register # Install gitlab-runner as a user service. # PLEASE NOTE you must enable autologin to this user # on the macos machine or your runner will be showing # as `stuck` the next time your macos machine reboots # and you don't login. su - $(whoami) cd ~ gitlab-runner install gitlab-runner start
Disable macos sleep for the logged in user
Ensure the mac doesn’t sleep, if you don’t set your mac not to sleep, it will, and then your runner won’t be able to pick up jobs, and will be showing as
sudo pmset -a sleep 0; sudo pmset -a hibernatemode 0; sudo pmset -a disablesleep 1
Optional ruby install with
asdf when using Fastlane
echo "ruby 2.7.6" > ~/.tool-versions asdf plugin-add ruby asdf install ruby 2.7.6 gem install fastlane
- Automating Jekyll card generation with ruby's Ferrum gem
- Use a basic Gmail account to "Send mail as" with a domain that uses Cloudflare email routing
- Get /dev/sdX device mappings for AWS nvme nitro disks on Ubuntu
- Recursively searching and downloading objects from AWS S3 with the `aws` CLI
- Quick overview of gitlab's CI/CD workflows, stages and jobs using gitlab 14.2+ in 2022