Azure DevOpsDevelopmentDevOps

How to setup private Mac Azure DevOps Agent.

 

Introduction.

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.

Azure DevOps Hosted Mac agents.

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):

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.

Mac build agent download from Azure DevOps portal

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 ./config.sh and ./run.sh.

Config & run Mac agent!

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.

Build pipeline.

Basic steps of my build pipeline:

  • Setting build agent pool.
  • Pulling the data from GitHub.
  • Compiling the code.
  • Putting executable to Azure Artifacts storage.
Setting build pool.

Pulling source code from GitHub..

Getting source code build step.

Compile code on my newly created Mac build agent.

Compile with g++ compiler on Mac

Store output to Azure DevOps Artifacts storage.

Step to push build output to 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:

Execution permission set, and execute console.

All fine, It works!

Conclusion

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.