With Homebrew you can have a package manager on MacOS or Linux Systems. Homebrew is provides install the stuff you need that Apple (or your Linux system) didn’t. Besides, you don't need a permission like a root and sudo for some packages.
MacPorts is a package manager used on the Mac operating system. MacPorts has a rich library of packages.