Remote Mac mini GitLab Runner Setup

Setup GitLab Runner on Mac mini for iOS CI/CD | VNCMac

12 min read
GitLab Runner iOS CI/CD Automation

Scaling iOS development requires a robust CI/CD pipeline. While cloud-based shared runners are convenient, they often lack the performance and environment control needed for complex Xcode builds. A dedicated Mac mini, especially when hosted in a high-performance cloud like VNCMac, provides the perfect balance of control and speed.

Why Use a Dedicated Mac mini for iOS Builds?

Native compilation on Apple Silicon (M2/M4) offers unparalleled performance for Swift and Objective-C. By setting up your own GitLab Runner on a remote Mac mini, you gain:

  • Faster Build Times: Dedicated hardware avoids the overhead of virtualization and shared resources.
  • Environment Consistency: Maintain exact Xcode, Ruby, and toolchain versions across your team.
  • Cost Efficiency: Predictable monthly or hourly costs compared to expensive CI/CD credit systems.

Step 1: Environment Preparation

Before installing GitLab Runner, your Mac mini needs the essential developer toolchain.

1. Install Xcode & Command Line Tools

Download the latest Xcode from the App Store and initialize the command line tools:

sudo xcodebuild -runFirstLaunch
xcode-select --install
2. Install Homebrew & Dependencies

Homebrew is essential for managing packages like Ruby and GitLab Runner itself:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install gitlab-runner ruby rbenv

Step 2: Installing and Registering GitLab Runner

Once the environment is ready, install the runner service and link it to your GitLab project.

  1. Start the Service:
    brew services start gitlab-runner
  2. Register the Runner: Run gitlab-runner register and follow the prompts.
    • Instance URL: e.g., https://gitlab.com/
    • Registration Token: Found in your GitLab project under Settings > CI/CD > Runners.
    • Executor: You must select shell for iOS builds to access the native Xcode environment.

Step 3: Configuring Code Signing with Fastlane

Automated builds require valid certificates and provisioning profiles. Fastlane Match is the industry standard for managing these securely.

Create a Gemfile in your project root:

source "https://rubygems.org"
gem "fastlane"

Initialize Match to sync certificates via a private Git repository:

bundle exec fastlane match init
bundle exec fastlane match appstore

Step 4: Defining the Pipeline (.gitlab-ci.yml)

Create a .gitlab-ci.yml file to automate the build, test, and deployment phases.

stages:
  - build
  - deploy

variables:
  LC_ALL: "en_US.UTF-8"
  LANG: "en_US.UTF-8"

build_job:
  stage: build
  script:
    - bundle install
    - bundle exec fastlane build_app
  tags:
    - ios
    - xcode
  artifacts:
    paths:
      - build/*.ipa

Performance Benchmarks

In our testing, an Apple M4 Mac mini instance on VNCMac achieved the following results for a medium-sized Swift project:

  • Full Clean Build: 4.5 minutes (vs. 12 minutes on standard cloud runners).
  • Unit Test Execution: 45 seconds.
  • IPA Archiving & Upload: 2 minutes.

Conclusion

Setting up a GitLab Runner on a remote Mac mini is a high-impact optimization for any iOS team. It provides the speed and reliability necessary for modern rapid release cycles. By leveraging VNCMac’s dedicated Apple Silicon infrastructure, you can eliminate build bottlenecks and focus on shipping features.

Dedicated Mac mini for Your CI/CD

Power your GitLab Runners with VNCMac's dedicated M2 and M4 instances. Performance, control, and reliability.

  • Latest Apple Silicon (M2/M4) Hardware
  • Pre-installed Xcode & Dev Tools
  • Secure, High-Speed Connectivity