How could I know how many packages are available for Homebrew and Macports?
MacPorts reports 7,303 ports. There are 1,124 formulae in the canonical homebrew repo (although I suppose some of its forks may add additional formulae).
It's worth noting, however, that MacPorts has a lot of ports that already ship with OS X. Homebrew, on the other hand, tries to use the libraries supplied with OS X whenever possible. And, for example, MacPorts also contains a port for each "major" version of Python (python24
, python25
, python26
, python27
, and python31
) for a total of 5 (as well as -doc
variants of each), whereas Homebrew only has two (one for Python 2.x and one for Python 3.x). Likewise, Homebrew has only one Ruby, whereas MacPorts has 3 (ruby
, ruby186
, and ruby19
). It also packages things differently: for example, the port for haskell-platform
has a dependency on each individual component (which are also ports), whereas Homebrew only as haskell-platform
. And, as noted in the comments, MacPorts includes a lot of things that are generally installed via easy_install/pip and RubyGems, whereas Homebrew doesn't include anything that is installed with those tools (distribute and pip itself are the only two exceptions to that rule that I know of).
I'd still wager MacPorts has more ports, but directly comparing the total number is difficult.