I recently started using Tomcat for a project I’m working on. Since I work on a Mac and am using Homebrew anyway, the installation was as easy:
brew install tomcat
The location of the installed files is
/usr/local/Cellar/tomcat on a Mac, BTW. Now, occasionally and out of habit, I run this:
brew update && brew upgrade && brew cleanup
I prefer (usually) small issues with small version jumps to upgrading rarely with bigger version changes (and issues). Also cleaning up seems a good idea, not only on the working desk or kitchen sink.
This time, though, the upgrade removed the previously installed version of Tomcat — including stuff that I had put into a sub folder of the location given above. Not only was the Tomcat installation upgraded, but everything I’ve put in there was gone. 😳
Lesson No. 1: Maybe I shouldn’t have put the stuff there in the first place.
Lesson No. 2: Learn how to pin a version of installed software, when using Homebrew.
It’s easy. Use, for example
brew pin tomcat
to, well, pin the tomcat version. To find out later, when you want to upgrade a piece of software and wonder why it does not happen, use
brew list --pinned
to find out, what software is pinned. Last but not least, a package can be unpinned using:
brew unpin <package_name>
Reading the Homebrew FAQ is also a good idea.