Continuous Integration and Delivery with GitLab is easier if you are developing your application on Linux. All you need to do is find a provider, spin up a VM, install GitLab Runner on it and configure your project's
.gitlab-ci.yml file. On macOS on the other hand, things may not be that easy. Finding a provider that offers a Mac machine that will be online 24/7 can be hard. MacStadium is here to help achieve that goal and offers a discount to all GitLab users. Let's see how to make this happen.
On this page
- Choosing a Mac mini plan
- Connecting to the Mac mini
- Setting up the development environment
- Installing and configuring the GitLab Runner
- Testing a project with CI
Choosing a Mac mini plan
The first step is to choose a plan. MacStadium offers many options, so you can pick whatever fits your needs. A Mac mini is perfect to test things out and is a good first choice. It should be enough to get you started, but depending on your needs you may have to upgrade to a more beefy machine.
Depending on your location and project needs, you have to:
- Choose the datacenter
- Choose the Mac mini
- Choose the macOS version
- Click Start Trial (24 hours) on the Mac mini of your choice to get going in a few steps
At first you'll be asked to create a MacStadium account Fill in your information and when in the Secure Checkout page, be sure to check the I want to use a coupon code option and use
GITLAB10 for 10% off.
At the time of this writing, the staged machines come with macOS 10.12.2. As new releases com from Apple, MacStadium tests them thoroughly and then update their staged machines. Of course, as a customer you can run the OS update on your own machine anytime.
Connecting to the Mac mini
When you sign up, you'll receive an email with two important pieces of information:
The static IP address of your Mac. This will allow you to find your Mac mini from anywhere in the world, and you can also point domain names to this IP address so it's easier to remember.
The username and password to access the machine. The user is standard for all installs, but the password is randomly generated. Upon the first login, you can and are encouraged to change it.
Connecting with VNC
If connecting from a Mac, Apple's Screen Sharing is ideal. It's installed on every Mac and can you can connect on your MacStadium Mac mini easily with the username and password that was sent to you via email.
If you don't have a favorite VNC client already, there are a number of options to choose from:
When you connect with VNC, you can use the same password that is set up for the user on the Mac mini.
macOS has that as a separate setting, but MacStadium's provision scripts enable VNC connections by default.
Connecting with SSH
You can SSH into your machine using the username and password. For example, if the username is
administrator and the IP address of your machine
Enter the password when asked (you won't be able to see it), hit Enter and you're in!
Setting up the development environment
The following steps are to be performed to the remote Mac machine. We need to install Xcode and the command line tools that contain the SDKs and UNIX development applications like the LLVM compiler, etc.
Apart from the needed toolset, the screensaver needs to be disabled otherwise the machine will be put to sleep, thus disrupting the workflow of CI. Thankfully, all the machines hosted on MacStadium are set to never sleep by default. It's just done in System Preferences > Energy Saver.
There are two ways to install Xcode. You can either download it from Apple's developer portal or use the App Store where you might be asked to fill in your credit card information. To avoid that, manually download Xcode:
- Connect via VNC to the remote Mac machine
- Open a browser and go to https://developer.apple.com/download/more
- Login with your existing AppleID or create one
Select the Xcode version you wish to install
This should download the Xcode package in your Downloads folder and decompress it automatically. After a couple of minutes it should finish.
Open a terminal and move
/Applicationsso that it can be found by Launchpad:
mv ~/Downloads/Xcode.app /Applications
- Go to your Applications, and double click on Xcode in order to install it. The verification will begin, that should take a minute.
- Answer "Open" when you are asked if you are sure you want to open it.
- Select "Agree" in the License Agreement and provide your administrator password.
- The installation process should begin and after a while you will have Xcode installed and ready to be used.
In the next step we will install the command line developer tools.
Installing the command line tools
The command line tools are a subsection of Xcode, so if you installed Xcode, you may skip this part.
Open the Terminal app or run this command via SSH:
Accept the License Agreement and the installation will begin
Now that all development tools are installed, it's time to install GitLab Runner.
Installing and configuring the GitLab Runner
GitLab Runner is responsible for running your jobs in macOS and then it reports the results back to GitLab.
To install it, follow the instructions in the Runner's documentation. Make sure to also carefully read the current limitations.
Testing a project with CI
The final piece of this puzzle is to set up a project in GitLab (your own CE/EE instance or even GitLab.com) and hook it up with Mac mini. We will not expand on that, but you can follow this nice blog post by Angelo Stavrow on Setting up GitLab CI for iOS projects. It includes comprehensive steps to get you started.
Having a dedicated Mac machine for your development can save you precious time when you follow the Continuous Integration workflow with your team. In this tutorial, you've seen how to quickly get a remote Mac mini up and running for your needs. Be sure to add the promo code
GITLAB10 on checkout for 10% off!
Get 10% off of all MacStadium plans by using GITLAB10 at checkout. The coupon can only be applied when signing up hardware, but if you are an existing customer who is using Gitlab and makes a change in hardware, you can always apply it again or request the discount in a ticket.
Cover image provided by MacStadium.