If you read my post about setting up custom Linux Azure DevOps build agent https://www.jenx.si/2019/05/27/how-to-setup-private-linux-azure-devops-agent/ then this post will be very familiar to you. I will try the same thing, but this time, I will use MacOS to set up Azure DevOps build agent.
Before I dig in, just one note – Azure DevOps has awesome hosted out-of-the-box support also for Mac building experience.
Nevertheless, I was eager to try how private MacOs build agents work with Azure DevOps.
Let’s build some code on MacOS.
I used exact the same code as for Linux demo (https://github.com/josipx/Jenx.LinuxAzureDevOps.Demo):
printf("Hello, jenx.si was here!\n");
but here, G++ compiler was used, i.e:
g++ input.c -o output.out
where input.c is source code, and output.out is compiled executable.
Custom Mac build machine.
I used my Mac laptop as a build machine. From Azure DevOps portal I downloaded Mac Azure DevOps agent.
Next, I decompressed the content of downloaded file.
Without going into too much details – steps are the same as with Linux Agent (https://www.jenx.si/2019/05/27/how-to-setup-private-linux-azure-devops-agent/ ) – I just run
My build agent was registered with success on my Azure DevOps server.
I was ready to create my pipeline in order to build code on my newly created Mac agent.
Basic steps of my build pipeline:
- Setting build agent pool.
- Pulling the data from GitHub.
- Compiling the code.
- Putting executable to Azure Artifacts storage.
Pulling source code from GitHub..
Compile code on my newly created Mac build agent.
Store output to Azure DevOps Artifacts storage.
Finally, I saved my build definition and triggered my build.
My build output!
Voilà! I have it, build artifact from my custom Mac based build agent. Just quick check:
All fine, It works!
If you want to build Mac apps on Azure DevOps and Azure hosted MacOs build agent templates are not sufficient (you have some special software, licenses, special requirements, etc…), then you can use custom Mac build agents as described in this post.