← Explore courses

Apple · Free course

Shell Scripting for Mac Admins

A practical introduction to shell scripting on macOS. Learn to write zsh scripts that automate everyday support tasks, then deploy them safely across a fleet through your MDM.

Modules
5
Time
2 h 55 min
Level
Intermediate
Cost
Free

What you'll learn.

  • How Terminal, the shell and a script differ, and why zsh is now the default on macOS
  • How to write, save and run a script, and fix the errors you will meet the first time
  • The everyday commands for managing files, plus wildcards, redirection and pipes
  • How variables, conditionals, loops and exit codes let a script make decisions
  • What changes when an MDM runs your script as root, and how to adapt for it
  • How to log, guard, test and roll out scripts without putting your fleet at risk

Who it's for.

IT administrators, helpdesk technicians and anyone who supports or manages Macs in an organisation and wants to automate repetitive tasks. No previous scripting experience is needed.

Course outline.

  1. Module 1: Shells, Terminal and Scripts Intermediate 35 min
  2. Module 2: Writing and Running Your First Script Intermediate 35 min
  3. Module 3: Essential Commands Intermediate 35 min
  4. Module 4: Scripting Building Blocks Intermediate 35 min
  5. Module 5: Scripting for Mac Admins Intermediate 35 min

Learn. Quiz. Earn a badge.

Short modules, a quick quiz after each one, and a badge when you finish the track. Pick up where you left off.

Start track →
Is this course free?

Yes. Public courses in the Dr Logic Academy are free. You just need an Academy account to save your progress.

How long does it take?

About 175 minutes, across 5 short modules. Go at your own pace and pick up where you left off.

How does it work?

Each module ends with a short quiz. Pass them all to complete the track.

Do I earn a badge?

Yes. You earn a badge when you complete the track, and it shows on your Academy profile.

Do I need any programming experience?

No. The course starts with what a shell is and builds up one step at a time. Basic familiarity with using a Mac is all you need.

Do I need a Mac to follow along?

You can complete the course without one, but you will get more from it with access to a Mac so you can try the examples in Terminal. For the examples that run as root, use a test Mac or virtual machine rather than one in daily use.

Which shell does the course use?

zsh, the default shell on macOS since Catalina. The course also explains how zsh differs from bash and sh, so you can read and adapt older scripts.

I already write bash scripts. Is this course still useful?

Yes. It covers the differences that break scripts moved between bash and zsh, and the practices specific to deploying scripts as root through an MDM.

Does the course cover a specific MDM?

No. It is vendor-neutral and explains how MDMs such as Jamf Pro, Addigy and Mosyle run scripts. Where details vary between platforms, it shows you what to check in your MDM's documentation.

More courses.

Explore all courses →