Skip to content

Instantly share code, notes, and snippets.

View clarityD's full-sized avatar
🎯
Focusing

Bryan Hiebert clarityD

🎯
Focusing
  • Clarity Development, Inc.
  • Olympia, WA
View GitHub Profile
@clarityD
clarityD / homebrew_auto_update.md
Last active April 3, 2023 08:03
Run scheduled jobs by user with launchd in macOS

Automating Homebrew Updates with Launchd

I have been using homebrew since 2016, but I frequently forgot to update brew and upgrade the installed packages. As I have been programming more, I wanted to find a way to automate the homebrew update/upgrade process.

Seeking Help from ChatGPT

I initially considered creating a shell script, but since I don't know shell scripting, I asked ChatGPT how to do it. I knew bash better than what I was currently using, zshell, and I was unaware of the differences in syntax or commands between the two. As I was querying the AI, I asked it if there was a way to run a program automatically. It reminded me of cron. At this point, I recalled that macOS also has another scheduling system, launchd.

https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html