Blog about a mac person trying linux and windows

How to use package manager Winget, Apt or Homebrew

In this article I will quickly tell what a package manager is and list common package manager commands that you can use with Winget on Windows, Apt (Apt-Get) on Linux and Homebrew on Mac (an unofficial package manager for Mac). I won’t go through in-depth the differences of the different package manager and how they work in this article. If you need to go back and forth between different package managers or you aren’t familiar with one of the package manager listed here, you might find this article useful.

Those of you that don’t know what a package manager is (especially users from Windows): A package manager allows you to install new apps quickly through command line. So you don’t need to go to every app companies’ web-site to download their apps. Especially if you need to quickly install a lot of apps at once (for example you are reinstalling your computer). It’s also a centered approach to update all your apps. Recently Microsoft has released their own package manager called Winget. It isn’t still yet completely finished, but there’s already more apps available there than in Microsoft Store. You can install the new package manager for example from directly downloading from Microsoft’s github: https://github.com/microsoft/winget-cli/releases

Search for apps:

How to search for an app if it is available in your package manager’s repositories:

# Winget
winget search appname
 
# Apt
apt search appname
 
# Homebrew
brew search appname

 

Installing apps:

Install an app:

# Winget
winget install appname
 
# Apt
apt install appname
 
# Homebrew
brew install appname

 

List all installed apps

List all installed apps. For Homebrew, this command will list all apps that you have listed through Homebrew (not the apps that you have installed through other ways). But for example Winget will list all the apps that are installed in your Windows (not just apps through Winget, so you will see for example Windows Updates there also). Because of this it might not be so useful to see quickly, if you have installed some app before. But you can use in “winget list appname”, to see if you have already installed the app or not.

# Winget
winget list
 
# Homebrew
brew list

 

List only a spesific app

If you don’t want the whole list of all the installed, you can also only list a specific app. For example if you just want to know, if some certain app is installed or not.

# Winget
winget list appname

# Homebrew (formulae)
brew list appname

# Homebrew (cask)
brew list --cask appname
 
 
 

Updating and upgrading apps (in Apt and Homebrew)

In Apt and in Homebrew you can easily update all your apps at the same time. But first you need to update your package manager’s database (so the package manager knows, if there’s an updates or not). After that you can run the upgrade command to install the updates. The package manager will during upgrade process show which packages will be updated, and you can cancel the update installation at that time, if you for example notice that you need some app to be on certain version.

# Apt update package database
apt update

# (Optional step) Apt list which packages can be upgraded
apt list --upgradeable

# Apt upgrade and install the new updates
apt upgrade



# Homebrew update package database
brew update

# (Optional step) Homebrew: list which packages can be upgraded
brew outdated

# Homebrew upgrade and install the new updates
brew upgrade

 

You can also upgrade and install an update to a certain app (if for some reason you want to update only one application).

# In Apt upgrade certain package and install the new update
apt --only-upgrade install appname 

# In Homebrew upgrade certain package and install the new update
brew upgrade appname

Updating and upgrading apps (in Winget)

As Winget is still in Beta, it has been reported that it might not be so good idea to upgrade all apps at once through Winget. The problem might be related that Winget itself list all apps that have been installed in your Windows (not just the applications that have been installed through Winget). For this reason, you should use Winget to update only apps that you have installed through Winget and one by one. With the following command you can update a specific app:

winget upgrade appname

 

 

To updates all apps in Winget at once, you can run the following command, but as stated before, Winget is currently in Beta and using the following command isn’t recommended:

winget upgrade -all

 

 

Sources: