Skip to content

Instantly share code, notes, and snippets.

@naaman
Last active March 5, 2021 20:57
Show Gist options
  • Star 46 You must be signed in to star a gist
  • Fork 29 You must be signed in to fork a gist
  • Save naaman/1384970 to your computer and use it in GitHub Desktop.
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

Worked like a charm! Thanks a lot.

@nakamuraagatha
Copy link

thanks

@endows
Copy link

endows commented Jun 25, 2015

+1

@realbisoye
Copy link

God bless you man

@dlaertius
Copy link

Thanks dude!

@Frikster
Copy link

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

@akkijp
Copy link

akkijp commented Apr 10, 2016

+1

@imchikachirag
Copy link

+1

@lymanZerga11
Copy link

lymanZerga11 commented Jun 17, 2016

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

indeed Great stuff !! many thanks

@JccSanabria
Copy link

Nice!!

@siddharth1001
Copy link

+1

@santhuuu0007
Copy link

thank you!

@scottyi
Copy link

scottyi commented Sep 17, 2016

Thank you. I love it !

@tagplus5
Copy link

thanks

@bbozo
Copy link

bbozo commented Oct 24, 2016

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

@notconfusing
Copy link

+1

Copy link

ghost commented Jan 24, 2017

Awesome!!!!!

@muatsoftgit
Copy link

parabens.. e muito obrigadão

@heyjorgedev
Copy link

Thanks!

Copy link

ghost commented Feb 10, 2017

awsm!!!

@ugmurthy
Copy link

nice - thanks naaman

@markmysourcecode
Copy link

awesome

@satheeshdragon
Copy link

it Works Thanks.....

@marieurbina
Copy link

Thank you!

@crj1001
Copy link

crj1001 commented Jun 18, 2017

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

Please, add unicode support!

@Sekator778
Copy link

+1 10q

@NdagiStanley
Copy link

Awesome, thank you

@naaman
Copy link
Author

naaman commented Oct 2, 2020

@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