Skip to content

Instantly share code, notes, and snippets.

@tamaki-shingo
Last active October 22, 2025 01:52
Show Gist options
  • Save tamaki-shingo/f48d5f0c8b3314955fbffb457cf2f4ab to your computer and use it in GitHub Desktop.
Save tamaki-shingo/f48d5f0c8b3314955fbffb457cf2f4ab to your computer and use it in GitHub Desktop.
# Here's an example of how to run a command to periodically keep homebrew up to date on your Mac:
1. Create a bash scrpit as below.
```
#!/bin/bash
brew update && brew upgrade && brew cleanup
```
2. Add a Permission
```
$ chmod +x ${shell script file as above}
```
3. Setup launchd
put plist at `~/Library/LaunchAgents/${Please replace this with your plist path}.plist`
```
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>${Please replace this with your script file name}</string>
<key>ProgramArguments</key>
<array>
<string>${Please replace this with your script path}</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>12</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
<key>RunAtLoad</key>
<false/>
</dict>
</plist>
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment