Jacob Ford
Jacob Ford

Reputation: 5193

Is there a Homebrew command to downgrade from HEAD to stable version of a package?

I brew install --HEAD'd node recently to see if the upstream version fixed a bug I was experiencing. (It did!)

Now I'd like to downgrade back to the stable, bottled version. Is there a simple command to do so?

brew reinstall simply pulls & rebuilds the HEAD version from upstream. (Where does Homebrew "remember" my HEAD preference?)

brew uninstall --ignore-dependencies && brew install is of course possible, but annoying given that it would also delete my build history & install receipts, which I'd like to keep around a bit if possible.

Upvotes: 7

Views: 1285

Answers (1)

Big McLargeHuge
Big McLargeHuge

Reputation: 16066

I did the same thing for pyenv while waiting for version 2.1.0 to make it into homebrew-core. I figured I'd simply uninstall pyenv and reinstall it without --HEAD, but when I attempted to do so, Homebrew told me:

Only uninstalling HEAD version because multiple versions are installed

(Or something like that.)

The documentation doesn't really explain this, as far as I can tell, but I did find an explanation here:

uninstall first removes whichever version is "active", i.e. linked into the main prefix. What happens when you run uninstall again depends on how many other versions are installed: if there is only one, it is removed, otherwise it errors out because it doesn't know which one to uninstall (unless you pass --force).

So I didn't need to do anything else, aside from delete the pyenv repository that Homebrew cloned under ~/Library/Caches/Homebrew/pyenv--git. (I think the fact that it doesn't remove this might be a bug.)

Now, if you first uninstalled node stable, then installed HEAD, your situation might be different.

(I know this might not be a great answer, but it's too long for a comment.)

Upvotes: 5

Related Questions