DEV Community

Cover image for macOS vs Ubuntu: GitHub Actions Runners
Pradumna Saraf
Pradumna Saraf

Posted on • Updated on

macOS vs Ubuntu: GitHub Actions Runners

In case you missed it, GitHub has made macOS Runner available for open source! This means we can now use macOS Runner for free in public repositories. You can read more about it here.

I thought it would be a great opportunity to compare the most commonly used runners - Ubuntu and macOS - and see if it's worth switching all my workflows to macOS runner.

So, the best way to test this is to run the same task on both runners and see the differences. Thus, I wrote a simple GitHub workflow to test the total time duration for a workflow using different runners. Here's the workflow I came up with:

name: Runner Test

on:
  workflow_dispatch:

jobs:
  test:
    runs-on: macos-latest

    steps:
    - name: Print OS Information
      run: |
        echo "Operating System: $(uname -a)"
        echo "Current Directory: $(pwd)"
        echo "List of files: $(ls -l)"

    - name: Execute Script
      run: |
        echo "Running script..."
        # Add your script commands here
        echo "Script execution completed."
Enter fullscreen mode Exit fullscreen mode

The results were as I expected: Ubuntu took the lead. For this workflow to run (for the first time), Ubuntu took 13 seconds to complete it, whereas macOS took 43 seconds, which is more than 3 times longer than Ubuntu. Refer to the screenshots below for reference:

macOS Runner:
macos workflow result

Ubuntu Runner:
Ubuntu workflow result

I tested multiple workflows, and not once did the macOS runner take the lead. So, the point I am trying to make is not that macOS is slow and not useful, but rather, going back to my original point and why I performed this test: Is it worth switching all my workflows to macOS, now that we have two runner options? The answer is NO.

However, this doesn't diminish the power of the macOS runner. There can be a lot of use cases, such as running Swift code or developing an Apple Silicon app and doing specific automation testing, etc., which perform way better on macOS compared to other operating systems.

Thanks for reading, and have a great day! You can also follow me on Twitter.

Top comments (5)

Collapse
 
steeve profile image
Steeve

Thanks for sharing, I didn't know MacOS runners are now available

Collapse
 
pradumnasaraf profile image
Pradumna Saraf

Thank you, Steeve for reading. Glad you find something useful.

Collapse
 
madhusaini22 profile image
Madhu Saini

Thanks for sharing, Pradumna!

Collapse
 
pradumnasaraf profile image
Pradumna Saraf

Thank you, Madhu, for reading.

Collapse
 
techwithsky profile image
Akash Pawar

That's very informative article!