Skip to content

Instantly share code, notes, and snippets.

@naaman
Last active February 5, 2025 05:47
Show Gist options
  • Select an option

  • Save naaman/1384970 to your computer and use it in GitHub Desktop.

Select an option

Save naaman/1384970 to your computer and use it in GitHub Desktop.
[WARNING THIS WILL HARD DELETE YOUR APPS. YOU COULD LOSE DATA. MAKE SURE YOU KNOW WHAT YOURE DOING!!!!!!!!!!] Delete all heroku apps from bash terminal -- no script file required
for app in $(heroku apps); do heroku apps:destroy --app $app --confirm $app; done
@BrainBuzzer

Copy link
Copy Markdown

Worked like a charm! Thanks a lot.

@nakamuraagatha

Copy link
Copy Markdown

thanks

@endows

endows commented Jun 25, 2015

Copy link
Copy Markdown

+1

@realbisoye

Copy link
Copy Markdown

God bless you man

@dlaertius

Copy link
Copy Markdown

Thanks dude!

@Frikster

Copy link
Copy Markdown

So beautiful because it just works just like that. This should be a community QA on SO

@akkijp

akkijp commented Apr 10, 2016

Copy link
Copy Markdown

+1

@imchikachirag

Copy link
Copy Markdown

+1

@lymanZerga11

lymanZerga11 commented Jun 17, 2016

Copy link
Copy Markdown

Nice. Just a slight modification
for app in $(heroku apps | awk 'NR>1 {print}'); do echo $app; heroku apps:destroy --app $app --confirm $app; done
This would remove the "===My Apps==" section too

@kanso-git

Copy link
Copy Markdown

indeed Great stuff !! many thanks

@JccSanabria

Copy link
Copy Markdown

Nice!!

@siddharth1001

Copy link
Copy Markdown

+1

@learnevolve

Copy link
Copy Markdown

thank you!

@scottyi

scottyi commented Sep 17, 2016

Copy link
Copy Markdown

Thank you. I love it !

@tagplus5

Copy link
Copy Markdown

thanks

@bbozo

bbozo commented Oct 24, 2016

Copy link
Copy Markdown

Thanks for this man, it saved my boss hours of work when he wanted to change a certificate :D

@notconfusing

Copy link
Copy Markdown

+1

ghost commented Jan 24, 2017

Copy link
Copy Markdown

Awesome!!!!!

@0PR3T0

0PR3T0 commented Jan 27, 2017

Copy link
Copy Markdown

parabens.. e muito obrigadão

@heyjorgedev

Copy link
Copy Markdown

Thanks!

ghost commented Feb 10, 2017

Copy link
Copy Markdown

awsm!!!

@ugmurthy

Copy link
Copy Markdown

nice - thanks naaman

@markmysourcecode

Copy link
Copy Markdown

awesome

@satheeshkumardeveloper

Copy link
Copy Markdown

it Works Thanks.....

@marieurbina

Copy link
Copy Markdown

Thank you!

@crj1001

crj1001 commented Jun 18, 2017

Copy link
Copy Markdown

I ran this command carelessly thinking it would apply to Heroku apps based off the current directory structure...

Now I've lost a production database... and I must ask, why would anyone EVER need this script? Who on earth has so many throw-away Heroku apps that it is actually too much work for them to run the heroku apps:destroy calls individually, typing in the confirmation every time? Someone mentioned they used it to change a certificate... what?? What kind of workflow requires the destruction of dozens of heroku apps to change a certificate? Why would any workflow need this?

Please prefix this with more of a warning. It looks like I'm not the only one to fall into this google-paste trap.

@kalaverin

Copy link
Copy Markdown

Please, add unicode support!

@Sekator778

Copy link
Copy Markdown

+1 10q

@NdagiStanley

Copy link
Copy Markdown

Awesome, thank you

@naaman

naaman commented Oct 2, 2020

Copy link
Copy Markdown
Author

@crj1001 I'm really sorry that happened. I hope you were able to ultimately restore your stuff :/

I forgot I even made this and only just used it to delete all my personal test apps as I'm leaving Heroku (as my employer, not the product). I updated the subject with a giant warning, but seems like it's still useful so am leaving this around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment