macOS Package Management
This is the first in a series of articles about package managers for various programs. Packages are optional plugins that provide some extra functionality to a program you use. They are often free and open source software (FOSS) made by individuals or consortiums. Packages are available to download for a range of programs: from apps you download (Sublime Text) to the operating system itself (macOS).
On macOS for example, the git package gives you the super-popular version control language git while the htop package will display computer diagnostics in your terminal.
Equally important are package managers that give you easy access to packages as well as the ability to maintain and update packages. Unfortunately, there is no unified package manager for all programs.
This series of articles will review packages and package managers for a variety of programs such as macOS, frameworks (node), languages (R, Python, Ruby), and text editors (Sublime, Atom, and Vim).
You will need to be a least a little familiar with the terminal to follow this guide; please see a quick overview here.
homebrew
brew: basic package management for command line software (distributed under open source). A simple run down and further documentation details are found at the brew website.
For installation simply type the following into terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
A breakdown of what is happening with the installation command above:
/usr/bin/rubycalls ruby (which is used to install homebrew); ruby is pre-installed on macOS-etells ruby to run raw code that is being passed to itcurlprogram to download contents at specified URLfsSLthis is actually four flags-ffail silently if something goes wrong-ssilent mode-Sdisplay error message if fails in silent mode-Lif server says that webpage has moved to a new location, curl will try that location
- URL: location of installation script
Terminology (for more details checkout the formula cookbook)
- formula is a package
- keg is the installation prefix
- cellar is where packages are installed
Some useful commands:
brew install [formula]install formulabrew searchsearch for formulasbrew cleanupcheck for problems and fix thembrew doctordiagnostic checkbrew tap caskroom/casknot all formulas are available on the main homebrew repository; to access these, you need to tap into a cask repo- Example: to install
Ryou must firstbrew tap homebrew/scienceand thenbrew install R
- Example: to install
cask
There is an extension for brew called cask for the installation of licensed software. Because cask is an extension of brew it works the same as brew in terms of commands and taps.
To install cask:
brew tap caskroom/cask
brew install brew-cask
To install a program like RStudio:
brew install Caskroom/cask/rstudio
Current Packages
Below is a select list of packages that I use brew to manage. Some are trivial (e.g., cowsay) while others are frequently used system wide (e.g., r)
Brew Packages
ansiweather display weather in terminal
cmatrix turn your terminal into the Matrix
coreutils utilities for GNU
cowsay display a cow (or other creature) saying something
curl transfer data with URL syntax
doxygen source code documentation and analysis tool
elinks text based web browser
emojify emojis on the command line
fasd quick access to files and directories
figlet display text as ascii art
fortune random quote
gcc GNU compiler collection
gdbm GNU database functions
git version control
givegif display gifs
glib core application building blocks for apps written in C
htop show computer diagnostics
node javascript framework
pipes-sh pipes screen saver
python python
r r
ruby ruby
sl have a steam locomotive run across your terminal
tmux terminal multiplexer
tree display directories as a tree
vim text editor
youtube-dl download youtube videos
zsh bash alternative
zsh-completions completions for zsh
Over the next few days I’ll add to this list and show some of the cool things you can do with them.
Future Installments
Below are future articles for other package managers that I frequently use.
- npm
- gem
- Python
- R
- Text editors: Sublime, Atom, Vim
- Docker