Make calibre updates less annoying
Published on Feb 05, 2014If you are dealing with ebooks you are probably aware of Calibre. It's ugly and a pain to use but it's currently the only application to use if you are serious about organizing your books and/or sync books not purchased on Amazon to your Kindle.
One of Calibres quirks is that it's updated frequently but isn't coming with an auto updater. Your only way to update is to re-download the ~82MB binary and replace your version with the new one.
I usually try to use cask for these kind of apps to make the process of updating them less annoying. In this case cask isn't working as expected because Calibre switched to just using latest
instead of explicit version numbers. This makes it (currently) impossible for cask to figure the right version to install.
What we are going to do is just removing the old calibre-latest
files from the cask cache, remove the old Calibre.app
from our system and reinstall the new one.
This isn't very elegant but it's a workaround until they figured out how to handle updates for applications installed via cask consistently.
Add this to your ~/.zshrc
:
function update-cask {
BREW_CACHE=$(brew --cache)
rm -r $BREW_CACHE/calibre-latest
brew cask uninstall calibre
brew cask install calibre
echo "Calibre updated to latest version! Updating other apps now..."
for c in `brew cask list`; do ! brew cask info $c | grep -qF "Not installed" || brew cask install $c; done
}
Now run source ~/.zshrc
to reload your shell config and it'll be available via update-cask
in your Terminal.