Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could "brew cask cleanup" remove older versions? #9586

Closed
Yann-R opened this issue Feb 13, 2015 · 17 comments
Closed

Could "brew cask cleanup" remove older versions? #9586

Yann-R opened this issue Feb 13, 2015 · 17 comments

Comments

@Yann-R
Copy link

Yann-R commented Feb 13, 2015

Hello,
Currently, when I install a new version of a software like this (libreoffice is just an example):

  1. brew cask install libreoffice
  2. brew cask cleanup

I get the new version of the software (if available), but the older version remains with the new one in the Caskroom.

It's not very practical and not consistent with brew cleanup. See man page:

cleanup [--force] [-ns] [formulae]
For all installed or specific formulae, remove any older versions from the cellar

Did I miss something?
Is there some workaround to perform a cleanup of older installed versions?
Is there a way to upgrade a software another way than with my command 1 above?

@Yann-R Yann-R changed the title Could "brew cask cleanup" remove older versions Could "brew cask cleanup" remove older versions? Feb 13, 2015
@Amorymeltzer
Copy link
Contributor

Hi @Yann-R, you're right on the money and are doing everything correct; the short answer is "not yet." homebrew-cask is very much pre-alpha, and one of the big pieces is properly implementing brew cask upgrade, currently being tracked in #4678. A major part of that is your very concern, proper uninstalling, as noted there and in #4651. It is definitely on everyone's mind!

@Yann-R
Copy link
Author

Yann-R commented Feb 20, 2015

OK, thank you for those explanations.
Since homebrew-cask works pretty well, I must admit I forgot its pre-alpha status :-)
We'll keep watching the current developments.

@erikkaplun
Copy link

until a fix, is it safe to manually remove the folder for the old version? or is there any way at all to have cask remove it itself? and if removed manually, will there be left any traces in a cask "registry" that there ought to exist the old version as well?

@metakermit
Copy link

@eallik I removed the old version of LibreOffice manually and the new version still seems to work.

@cybertk
Copy link
Contributor

cybertk commented Oct 21, 2015

Is there any other solutions beside rm manually?

@vitorgalvao
Copy link
Member

Is there any other solutions beside rm manually?

No, and there won’t be since we’ll stop keeping old versions.

@cybertk
Copy link
Contributor

cybertk commented Oct 21, 2015

So there won't have any older versions after I cleanup all existing old versions manually?

@vitorgalvao
Copy link
Member

Only after we implement #13201. Until now, everything is still the same.

@troyxmccall
Copy link
Contributor

@cybertk & @Yann-R: I have a rudimentary ruby script for updating casks here: https://github.com/troyxmccall/dotfiles/blob/49bbdf9773117d7d7b0704e7add41dc5d3f4ff6c/bin/cask-upgrade

I also have a cask-retire() bash function that only prunes old versions if that's more up(date) your alley: https://github.com/troyxmccall/dotfiles/blob/8ab354f96f1184cbdd3574b3285a7afe89f2d9f3/.functions#L399-L422

@tommyvdv
Copy link

@troyxmccall thanks!

Shouldn't this line use __clean-cask instead of clean-cask?

@Kristofp
Copy link
Contributor

brew cask cleanup −−outdated

This will clean up cached downloads and tracker symlinks. With −−outdated, it only cleans up cached downloads older than 10 days old.

@jpickwell
Copy link

brew cask cleanup && brew cask list --versions

You'll still see old versions installed.

@jpickwell
Copy link

I created an updated version of @troyxmccall's function as a script. https://gist.github.com/jpickwell/afb7bfc8b166b58150b6c311f34ed271

My version also removes the old .metadata directories which tell brew cask which versions are installed. It also handles version sorting correctly.

@specious
Copy link
Contributor

specious commented Jan 5, 2018

@jpickwell, that's brilliant!

Probably won't become an official tool, so I made a nice short link: https://j.mp/brew-cask-retire

@vitorgalvao
Copy link
Member

Please don’t necropost. Especially in this case, where the script isn’t necessary at all. brew cask upgrade is very much live and officially supported and it removes old versions when upgrading.

@Homebrew Homebrew locked as resolved and limited conversation to collaborators Jan 5, 2018
@Homebrew Homebrew unlocked this conversation Jan 5, 2018
@vitorgalvao
Copy link
Member

I’ve unlocked since @specious wants to expand on the point of the script.

But please note the script is not officially supported. As such, any problems or doubts arising from its use need to be posted at its source, not on the Caskroom organisation.

If the discussion elongates more, I’ll relock.

@specious
Copy link
Contributor

specious commented Jan 6, 2018

@vitorgalvao, I fully appreciate your suggestion to continue further discussion pertaining to the maintenance script made available by @troyxmccall and @jpickwell at the appropriate forum.

I would like to mention that since brew cask upgrade does not effectively remove all versions of old casks left over from before brew cask upgrade was introduced, this is still a relevant topic for people who come from using brew cask since prior to this relatively recent feature becoming available.

Also, it may be necessary in special cases where you installed a new version of an application manually (outside brew cask) over a previously installed cask and then want to manually remove the older installed cask, since you didn't use brew cask upgrade and you also don't want to runbrew cask uninstall because it will remove your installed application. I know this is not the homebrew way, but I've had that happen and then wanted to clean up.

I'd like to propose to leave this discussion open in good faith that potential participants be respectful and contribute prudently. Locking the topic prevents other contributors from being able to react to a point already made or to provide a different perspective that none of the existing contributors have possibly considered.

@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests