Self-Hosted GitLab Runner for iOS: Rent, Buy, or Hack?

Alexander PanovAlexander Panov
5 min read

Managing GitLab CI/CD can be overwhelming, especially when it comes to deploying iOS/macOS applications. Recently, we released a comprehensive Udemy course covering everything about GitLab CI/CD pipelines, from beginner to advanced topics. Whether you’re new to CI/CD or want to deepen your knowledge, this course is packed with over five hours of detailed, practical knowledge.

In this blog post, I want to share my journey of setting up a self-hosted GitLab runner for iOS development. If you’re looking to build iOS apps with GitLab CI/CD but struggling to find the right solution, keep reading to discover the options I explored, what worked for my organization, and recommendations based on my experience.

The Challenge: Deploying iOS Apps with GitLab CI/CD

When I first set up a self-hosted GitLab instance, I was excited to automate the deployment of our iOS and macOS applications. But as I delved into the process, I realized that getting a macOS GitLab runner isn’t as straightforward as spinning up a regular runner for Linux or Windows.

GitLab offers hosted macOS runners as part of its SaaS offering. These runners, tagged as saas-macos-medium-m1, are a convenient solution if you’re using GitLab’s hosted service. However, for organizations using self-hosted GitLab or those that need more control over the infrastructure, finding and managing macOS machines for GitLab runners can be a challenge.

Solution 1: Rent a macOS Machine from a Cloud Provider

If your organization allows the use of cloud-hosted machines, renting a macOS server is one of the easiest solutions. Several cloud providers offer macOS machines specifically for CI/CD purposes, which can save time and effort in managing your own hardware.

Here are a few recommended providers:

MacInCloud: A popular choice for macOS cloud hosting. They offer a variety of plans depending on your development and CI/CD needs.

Scaleway Mac Mini: Offers powerful Mac Mini machines hosted in the cloud, which are perfect for CI/CD tasks like building and testing iOS apps.

These providers allow you to rent dedicated macOS instances, so you don’t have to worry about hardware maintenance. You can easily register these machines as GitLab runners and start building your iOS applications immediately.

Solution 2: Buy a Mac Mini and Self-Host

For companies that prefer to manage their own infrastructure, buying a Mac Mini and hosting it on-premise is a solid option. The Mac Mini is a cost-effective machine that can handle most CI/CD workloads, including building iOS apps. By setting up a self-hosted runner, you gain complete control over the hardware and software environment.

Self-hosting a Mac Mini is relatively simple:

1. Purchase a Mac Mini and set it up in your office or data center.

2. Install the GitLab runner software and register the runner with your GitLab instance.

3. Configure the runner with the appropriate tags, such as macos, to ensure it’s used for iOS/macOS jobs.

This solution is ideal for teams that need full control over their infrastructure, especially for security or compliance reasons. The downside, however, is the overhead of maintaining and updating the hardware yourself.

Solution 3: Hackintosh – A DIY macOS Virtual Machine

If you’re feeling adventurous and are familiar with macOS internals, building a Hackintosh (a non-Apple machine running macOS) is an option. This involves setting up a macOS virtual machine or installing macOS on non-Apple hardware. While not officially supported by Apple, it can be a viable option for those who want to run macOS without buying Apple hardware.

However, setting up a Hackintosh can be tricky. It often requires custom configurations and can be less stable than using a genuine Mac. Additionally, since it’s not officially supported, there can be legal implications depending on your use case, so proceed with caution.

Alternative Consideration: Switch to Expo for React Native Apps

If you’re in the early stages of developing a mobile app, and you’re using React Native, you might want to consider switching to Expo. Expo offers a managed CI/CD environment that simplifies the process of building, testing, and deploying React Native applications, including iOS apps. This could be a good alternative to setting up a dedicated macOS runner if you haven’t fully committed to a native iOS app development workflow.

Final Thoughts: Which Option Is Right for You?

After weighing the pros and cons, here’s my recommendation based on different scenarios:

For ease of use: If you want minimal setup and maintenance, go with a cloud provider like MacInCloud or Scaleway. This option offers the most convenience, especially for teams that need fast deployment.

For full control: If your organization requires on-premise infrastructure or strict control over the environment, buying and self-hosting a Mac Mini is the way to go.

For the adventurous: If you’re technically inclined and want to experiment, a Hackintosh could work, but it’s not for the faint of heart and may not be sustainable for production environments.

At the end of the day, the solution you choose will depend on your specific needs, budget, and technical expertise.

Conclusion: Mastering GitLab CI/CD for iOS

By exploring these options, I was able to find the right solution for my organization. We opted for the mac mini solution because it offered the best balance between cost, control, and ease of use.

However, before diving into these advanced topics, it’s essential to have a strong understanding of GitLab CI/CD itself.

That’s why I highly recommend checking out our Udemy course. It covers everything you need to know about GitLab pipelines, from setting up runners to advanced CI/CD workflows, ensuring you have the knowledge to make informed decisions for your team.

With the right setup, you’ll be able to streamline your iOS app development process and take full advantage of GitLab CI/CD!

Related Links:

GitLab Docs: Hosted macOS Runners

MacInCloud

Scaleway Mac Mini Hosting

0
Subscribe to my newsletter

Read articles from Alexander Panov directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Alexander Panov
Alexander Panov

Software developer and CEO at RoyalZSoftware. I build web applications for startups with Ruby on Rails, Angular and React.