Run a Heroku command on multiple apps

1. Select the apps you want

heroku apps --json | jq -r '.[]["name"]' | grep [your filter string here] > apps.txt

Each app now exists as a single line in the apps.txt file. View this and make any changes to the list as you see fit.

2. Run your commands on each app

cat apps.txt | while read line ; do
  heroku <command> -a $line
done


In my case, I wanted to delete a bunch of apps quickly:

cat apps.txt | while read line ; do
  heroku apps:destroy -a $line --confirm $line
done

But this is useful for updating permissions in bulk too:

cat apps.txt | while read line ; do
  heroku access:update test@example.com -p deploy,operate,view -a $line
done