Skip to content

Instantly share code, notes, and snippets.

@singularitti
Last active October 4, 2025 11:27
Show Gist options
  • Save singularitti/9c2307690441bb30108ab3902aa2834a to your computer and use it in GitHub Desktop.
Save singularitti/9c2307690441bb30108ab3902aa2834a to your computer and use it in GitHub Desktop.
Homebrew snippets #macOS #Homebrew
using IOCapture
function livecheck(cask)
try
c = IOCapture.capture() do
run(`brew livecheck --cask $cask`)
end
str = c.output
regex = Regex(cask * ":[ ]+([^=]+)[ ]+==>[ ]+([^\n]+)")
m = match(regex, str)
if !isnothing(m)
old, new = m.captures
if new >= old
return new
end
end
catch e
print(e)
return nothing
end
end
function bump_cask_pr(cask)
version = livecheck(cask)
if !isnothing(version)
try
run(`brew bump-cask-pr $cask --no-browse --write-only --commit --version $version`)
catch e
print(e)
return nothing
end
end
end
#!/bin/bash
brew alias au='audit --new --online'
brew alias arm='autoremove'
brew alias b='bundle'
brew alias bd='bundle dump'
brew alias ug='upgrade'
brew alias dt='deps --tree'
brew alias d='doctor'
brew alias i='install --verbose --debug'
brew alias if='info'
brew alias ifg='info --github'
brew alias e='edit'
brew alias h='home'
brew alias ri='reinstall'
brew alias l='list --formula'
brew alias lv='list --formula --versions'
brew alias ll='list --formula -l'
brew alias ld='list --installed-as-dependency'
brew alias le='leaves'
brew alias o='outdated'
brew alias s='search'
brew alias sf='style --fix'
brew alias c='cleanup --prune=all -s'
brew alias use='uses --recursive --installed' # From https://zanshin.net/2014/02/03/how-to-list-brew-dependencies/
brew alias fpr='bump-formula-pr --no-browse --version'
brew alias z='uninstall --force --zap'
brew alias sv='services'
# From https://zanshin.net/2014/02/03/how-to-list-brew-dependencies/
brew list --formula | while read cask; do
echo -n "\e[1;34m$cask ->\e[0m"
brew deps $cask | awk '{printf(" %s ", $0)}'
echo ""
done
brew alias ci='install --cask'
brew alias cl='list --cask'
brew alias clv='list --cask --versions'
brew alias cll='list --cask -l'
brew alias cx='uninstall --cask'
brew alias cz='uninstall --zap --force --cask'
brew alias cif='info --cask'
brew alias cpr='!julia -e "include(expanduser(\"~/.brew.jl\")); bump_cask_pr(ARGS[1])"'
brew alias fa='find-appcast' # See https://github.com/Homebrew/homebrew-cask/issues/174192
# Install casks from local tap
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_INSTALL_FROM_API=1
# Generate cask token
"$(brew --repository homebrew/cask)/developer/bin/generate_cask_token" "/full/path/to/new/software.app"
# Create the cask file
brew create --cask --set-name my-new-cask download-url
# Find app cast
brew find-appcast "/path/to/application.app"
# Create zap stanza
brew tap nrlquaker/createzap
brew createzap cask-name
brew install my-new-cask
brew audit --new --cask my-new-cask
brew style --fix my-new-cask
"$(brew --repository homebrew/cask)/developer/bin/list_loaded_launchjob_ids"
"$(brew --repository homebrew/cask)/developer/bin/list_installed_launchjob_ids"
"$(brew --repository homebrew/cask)/developer/bin/list_ids_in_app" '/path/to/application.app'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment