📦 Package Managers
This page defines the fundation of the package manager ecosystem.
Pacakage Manager | CLIs | Installable | Source | Global | Project | Website |
---|---|---|---|---|---|---|
Debian | apt | Package | PPA | ✅ | ❌ | Ubuntu Packages Search |
Homebrew | brew | Formula / Formulae / Cask 1 | Tap | ✅ | ❌ | Homebrew |
Python | pip | Module | URL | ✅ | ❌ | PyPI |
npm | npm | Package | ✅ | ✅ | npm | |
Ruby | gem , bndle | Gem | URI | ✅ | ✅ | RubyGems |
Go | go | Package | Go Packages |
Exploring
Dependency
List all dependencies of an installable.
In another word, find out a package depend on which other packages.
apt
Homebrew
Python
npm
Ruby
Go
apt depends _
brew deps _
pipdeptree --packages _
npm ls _ --all
gem dependency _
# Open a PR to complete this 🫶🏻
For npm
, you need to install the package first before you can list its dependencies.
In addition, this command is expected change in the future.
Information
Show or view the information of an installable.
apt
Homebrew
Python
npm
Ruby
Go
apt show _
brew info _
pip show _
npm info _
gem info _
# Open a PR to complete this 🫶🏻
Reverse Dependency
List all dependent installables of a installable.
In another word, find out which installables are using / depend by a installable specified.
apt
Homebrew
Python
npm
Ruby
Go
apt rdepends _
brew uses _
pipdeptree --reverse --packages _
npm explain _
gem dependency _ --reverse-dependencies
go mod why _
Search
Find an installable.
apt
Homebrew
Python
npm
Ruby
Go
apt search _
brew search _
pip search _
npm search _
gem search _
# Open a PR to complete this 🫶🏻
Install
Install Globally
Globally install an installable on the environment.
apt
Homebrew
Python
npm
Ruby
Go
apt install _
brew install _
pip install _
npm install -g _
gem install _
go install _
Install from List
Install installables from a list of file, file name varies by convention.
apt
Homebrew
Python
npm
Ruby
Go
xargs -a Aptfile apt install
# Open a PR to complete this 🫶🏻
pip install -r requirements.txt
# Open a PR to complete this 🫶🏻
# Open a PR to complete this 🫶🏻
# Open a PR to complete this 🫶🏻
Install Project
Install installables for a project, file name varies by convention.
apt
Homebrew
Python
npm
Ruby
Go
# N/A
# N/A
# See Install from list
npm install
bundle install
# Open a PR to complete this 🫶🏻
Upgrade
Upgrade
Upgrade an installable.
apt
Homebrew
Python
npm
Ruby
Go
apt upgrade _
brew upgrade _
pip install --upgrade _
npm update -g _@latest
gem update _
go get -u _
Upgrade All Globally
Upgrade all global installables.
apt
Homebrew
Python
npm
Ruby
Go
apt upgrade
brew upgrade
pip list --outdated --format=json | jq '.[] | .name' | xargs -n1 pip install -U
npm update -g
gem update
# Open a PR to complete this 🫶🏻
The pip commands is modified from this StackOverflow answer.
Uninstall
Uninstall
Uninstall an installable.
apt
Homebrew
Python
npm
Ruby
Go
apt remove _
brew uninstall _
pip uninstall _
npm uninstall _
gem uninstall _
# Open a PR to complete this 🫶🏻
Uninstall All
Uninstall all global installables.
apt
Homebrew
Python
npm
Ruby
Go
apt remove --purge $(dpkg -l | grep '^rc' | awk '{print $2}')
brew uninstall --force $(brew list)
pip freeze | xargs pip uninstall -y
npm ls -gp --depth=0 | awk -F/ '/node_modules/ && !/\/npm$/ {print $NF}' | xargs npm -g uninstall
gem uninstall -aIx
# Open a PR to complete this 🫶🏻
The credits for npm commands go to this StackOverflow answer.
Uninstall Useless
Uninstall useless packages that are not required or not used.
Always manually test after running this command to ensure that your project still works as expected.
apt
Homebrew
Python
npm
Ruby
Go
apt autoremove
brew autoremove
# Open a PR to complete this 🫶🏻
npx npm-check # or npx depcheck
gem cleanup
go mod tidy
Listing
List Globally Installed
List all globally installed packages.
apt
Homebrew
Python
npm
Ruby
Go
apt list --installed
brew list
pip list
npm list -g --depth=0
gem list
# Open a PR to complete this 🫶🏻
List Globally Undepend
List all global packages that are not dependencies of any other global package.
Installable listed by this command typically are not needed anymore and can be removed.
apt
Homebrew
Python
npm
Ruby
Go
# Open a PR to complete this 🫶🏻
brew leaves
pip list --not-required
# Open a PR to complete this 🫶🏻
# Open a PR to complete this 🫶🏻
# Open a PR to complete this 🫶🏻
List Globally Upgradable
List all global packages that have updates available.
apt
Homebrew
Python
npm
Ruby
Go
apt list --upgradable
brew outdated
pip list --outdated
npm outdated -g --depth=0
gem outdated
# Open a PR to complete this 🫶🏻
List Installed (Project)
List all installed packages in the current project.
apt
Homebrew
Python
npm
Ruby
Go
# N/A
# N/A
pip freeze
npm list --depth=0
bundle list
# Open a PR to complete this 🫶🏻
List Upgradable (Project)
List all upgradable packages in the current project.
apt
Homebrew
Python
npm
Ruby
Go
# N/A
# N/A
# N/A
npm outdated --depth=0
bundle outdated
# Open a PR to complete this 🫶🏻
Source
Add Source
Add sources to the package manager to install packages from the new source.
apt
Homebrew
Python
npm
Ruby
Go
add-apt-repository _
brew tap _
pip config set global.index-url _
# Open a PR to complete this 🫶🏻
gem sources --add _
# N/A
List Sources
List all sources where installables can be installed from.
apt
Homebrew
Python
npm
Ruby
Go
apt policy
brew tap
pip config get global.index-url
# Open a PR to complete this 🫶🏻
gem sources --list
# N/A
If the pip
command yield ERROR: No such key
, it means the source is the default index url, which is https://pypi.org/simple.
Remove Source
Remove a source from the list of sources used to resolve packages.
apt
Homebrew
Python
npm
Ruby
Go
add-apt-repository --remove _
brew untap _
pip config unset global.index-url
# Open a PR to complete this 🫶🏻
gem sources --remove _
# N/A
Update
Update installable information from the sources.
apt
Homebrew
Python
npm
Ruby
Go
apt update
brew update
# N/A
# N/A
gem sources --update
# N/A
Mainenance
Cleanup All Cache
Clean up all cache. Does not remove any packages.
apt
Homebrew
Python
npm
Ruby
Go
apt clean
brew cleanup --prune=all
pip cache purge
npm cache clean
gem sources --clear-all
# Open a PR to complete this 🫶🏻
Cleanup Useless Cache
Clean up useless cache. Does not remove any packages.
apt
Homebrew
Python
npm
Ruby
Go
apt autoclean
brew cleanup
# N/A
npm prune
# N/A
# Open a PR to complete this 🫶🏻
Healthcheck
Run a healthcheck / diagnosis to verify the package manager / installation is working correctly.
apt
Homebrew
Python
npm
Ruby
Go
# Open a PR to complete this 🫶🏻
brew doctor
pip check
npm doctor
gem check
# Open a PR to complete this 🫶🏻
Footnotes
-
Homebrew refers to its installables as
formula
/formulae
, which is normally a CLI tool, andcask
for everything else, like apps, fonts, and such. ↩