Update Monday 2nd of April 2018: I decided to add to this post how to update the RubyGems since they are a key feature of Jekyll.
Update Thursday, 19th of April 2018 11.00 UTC+3: I added info about how to update on the CLI the App Store Apps and macOS software updates.
In the post about Homebrew I think I’ve already posted how I update Homebrew packages with a single comment in the terminal. However these days I update more software via terminal, mainly packages, because it’s really handy run just a couple of commands and then see how the software it’s updated automatically and easily.
To update Homebrew packages I run:
brew update && brew upgrade && brew cleanup && brew prune && brew cu -ay && brew cask cleanup
brew updateupdates Homebrew itself and download the last version of the formulae
brew upgradeupdates the packages you have installed that have new formulae.
brew cleanupcleans the cache of old versions of packages.
brew pruneclean the old symbolic links form `/usr/bin/`.
brew cu -ayuses buo/homebrew-cask-upgrade to update casks.
-ayflag is all and yes update all outdated apps.
brew cask cleanupclean the old caches of the updated apps.
If for some reason you don’t want to update an specific package in Homebrew, you can _pin _in to an specific version or the current version.
brew pin <formulae>
To update R packages I run:
# to see what are the old packages
Rscript --vanilla -e "old.packages(repos = 'cloud.r-project.org')"
# to directly update
Rscript --vanilla -e "update.packages(ask = F, repos = 'cloud.r-project.org')"
Update R packages on terminal is done using the command
Rscript that allows us to send commands to R using the shell. I use the flag
--vanilla that combine
--no-environ. In other words a way to load R faster and with a standard configuration.
I like to run
old.packages first because I like to see a list first of the packages I’m going to update and then update. I do this because some packages —data.table— need a different
makevars than the rest of the packages so just in case I needed to change the
makevars and rebuild that package.
I really think it would be cool to be able also _pin _packages in R, but I haven’t found any way to do so at system wide level. You can do easily at project level with the package Packrat. However, I really think it would be really nice to have email notifications when new versions of packages hit CRAN repository and some function to pin packages to the current version.
To update all the packages from pip and pip itself I run:
pip install --upgrade pip && pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
pip3 install --upgrade pip && pip3 freeze --local | grep -v '^-e' | cut -d = -f 1 | xargs -n1 pip3 install -U
I took the idea from here.
pip is the package manager for packages written in Python. You can read a little bit more on the Wikipedia.
RubyGems is a package manager for Gems that are packages written in Ruby language. Homebrew is written in Ruby and Jekyll too, the latter make use of several RubyGems for functionalities and extensions.
To update the RubyGems you run the following command:
App Store and macOS software updates
Although these ones are really easy and you can update them just using the Mac App Store app in your Mac, it’s possible to trigger the update checking and the update itself through CLI. macOS has a command that allow you to make this happen
softwareupdate. You can run it like this:
softwareupdate -l ## to list all the updates
softwareupdate -i ## to install updates
softwareupdate -ia ## to install all updates
softwareupdate -iR ## to automatically restart if necessary by the update
softwareupdate -ir ## install only the recommended updates
softwareupdate -d ## only download the updates
As you see it’s quite thorough and you can see more options with running
If you want something more complex you can install mas-cli, which is a Mac App Store command line interface. Install you just run:
brew install mas
Then, you can run in your command line the following to update:
mas list ## List your Mac App Store apps
mas search <app> ## Search for an app
mas install <app-number> ## Install an specific app
mas outdated ## shows the outdated apps
mas upgrade ## Upgrade all your apps
mas upgrade <app-number> ## Upgrade an specific app