Skip to content

Repository files navigation

# Brewt


This began as a simple bash script I ran via cron. At some point, I decided I wanted to run it as a launchagent
because cron jobs won't run while the laptop is in sleep mode at the scheduled time, nor when it wakes up. With
launchagent and recent osx versions, apps needs "full disk access" for some reason. Except the app is this case is
bash, and not my script specifically. That didn't feel safe, nor something I'd want to share with others. 3 stars
aligned to form this rabbit hole of a project: wanting to share this with others because I grew tired of pestering
colleagues to update their brew formulas, remembering how running shell commands was so easy in Kotlin, and a vague
desire to learn about Kotlin Multiplatform to build native binaries from Kotlin code.

As with every personal bash script ever written, all sorts of rabbit holes are calling. This is the result.

My initial "brew-update-all-the-things" script was vaguely acronymed into buatt to brut to brute to brewt. I suppose the
alternative would have been brat.

# Install
```
brew tap gjoseph/tap
brew trust gjoseph/tap
brew install brewt
```

# Run

One shot:
```
brewt
```

Schedule:
```
brewt schedule --daily
```

See `brew --help` for more options.

# Configuration
On OSX: ~/Library/Preferences/brewt/brewt.toml
```
ignored = ["microsoft-excel"]
```

TODO: restart apps (casks) after updates
=======================================================================================
See Homebrew/brew#12709
Homebrew/homebrew-cask#104074
--> not quite true, apps aren't closed when updating (see Jetbrains Toolbox)
osascript -e 'tell application id "com.jetbrains.toolbox" to quit'
osascript -e 'tell application id "com.jetbrains.toolbox" to open' # kinda works, with an error
open -b "com.jetbrains.toolbox" # works
find app bundle:
brew info --json=v2 jetbrains-toolbox | jq -r '.casks[0].artifacts| .. | .launchctl? | select(. != null)'


TODO: CLI to show/create config file (perhaps the same that initialises launchagent...)
=======================================================================================

TODO Setup launchagent
=======================================================================================
 - see https://github.com/vinceglb/AutoLaunch/blob/main/auto-launch/src/commonMain/kotlin/io/github/vinceglb/autolaunch/AutoLaunch.kt
 - https://launchd.info/
 - previously tried:
lunchy install -s ~/bin/brew-update-launchctl.plist
lunchy start -w brew-update-launchctl

fails with i/o error - with the real launchctl commands, the only way to get even a simple test job to run is to use the gui context, so
the stuff about process type of limitloat to session type might help!?

stuff like this might help too?!?
<key>ProcessType</key>
<string>Background</string>
<key>LimitLoadToSessionType</key>
<string>Aqua</string>

<key>KeepAlive</key>
    <dict>
          <key>SuccessfulExit</key>
When set to true the job will be restarted until it fails.
Setting this value to false will restart the job until it succeeds.

    <key>ThrottleInterval</key>
    <integer>60</integer>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages