For many years, I used nothing but various flavours of linux (most recently, Linux Mint). I was so used to installing stuff using package managers (apt-get and yum). It was so easy, for example, to get the LAMP stack up and running.
I recently switched to a Mac, and I suddenly miss the familiar apt-get. Some packages come as .pkg, others as .dmg and lots without any package (for example, apache or php). For these, I have to use pseudo package managers such as Macports or Homebrew.
My question is: which is the best way to install various open-source packages on a Mac?