225

I'm just migrating from Ubuntu Linux to Mac, and everything is new and I'm re-learning a lot of stuff.

On Linux I had the excellent apt-get to manage software packages. I googled for an alternative on Mac and found about MacPorts, Fink and Homebrew.

I will use this computer primarily to develop Ruby on Rails applications.

So, what are the differences between them? Which are the upsides and downsides? Which one is best maintained and has more packages?

0

7 Answers 7

165

Definitely Homebrew. I started with Fink, then switched to MacPorts (happier), then Homebrew (much, much happier). These are my reasons for using each (a pro list if you will):

Fink

  • Apt-based - feel right at home if you come from a Debian-based environment.

MacPorts

  • Unlike homebrew do not depend on MacOS library that may change in the future.
  • Install everything in: /opt/local
  • Nice variants system that lets you customise the build.
  • Easy and intuitive port files, also allows you to add your own.
  • Supports many versions of macOS going back to Mac OS X Tiger including PowerPC versions see other answer.

Homebrew

  • Maximum leveraging of what comes with OS X. Unlike Fink or MacPorts, it does not require you to build/install ruby and libraries from scratch just to install some small Ruby-based tool.
  • Installs into /usr/local (Intel) or /opt/homebrew (Apple Silicon)
  • Install without root access.
  • Every installed package is cleanly sandboxed into its own cellar so you don't have stray files all over your system, just symlinks from bin, man, etc.
  • Has guides and automation to create your own formula files (ie. package descriptors).
  • Written in ruby and all formulas are concise ruby scripts.

pkgin

  • Everything installed in: /opt/pkg
  • Backed by pkgsrc community and Joyent
  • Known to work on NetBSD, DragonFly BSD, Solaris, Debian, macOS, Minix

https://pkgsrc.joyent.com/install-on-osx/

http://pkgin.net/

1
  • Comments are not for extended discussion; this conversation has been moved to chat. If the chat room needs to be unfrozen, please raise that issue on Ask Different Meta or with a flag.
    – bmike
    Commented Feb 6, 2021 at 21:09
86

MacPorts

It is more independent of Mac OS X, this means MacPorts will just ignore many of the system libraries and software that's already available in Mac OS X and pull its own one instead, which could be slower when the utility you install requires some set of large libraries and software.

But this kind of choice is safer because the packages you installed are less influenced by Apple's system update/upgrade procedure.


Homebrew

It is more dependent on existing Mac OS X installed packages, so this will speed up the installation of packages and minimize redundant libraries.

But the risk is installed packages might be broken because of Apple's system update/upgrade.

So, these are the two different kind of tradeoff.

Also, Homebrew takes over /usr/local by default, which some folks don't like because it somehow conflicts with the Unix tradition and might cause problems if you’ve already installed anything there (MySQL, etc.)


Apart from these differences, considering the packages these two can offer, you can check with these two commands if you already have MacPorts/Homebrew installed, which show you the packages they currently provided:

port list | wc -l
brew search | wc -l

And you will find out that MacPorts has many more packages than Homebrew.

(19399 v.s 3583 on May 13 2016)

8
  • 28
    As a remark on the differing number of packages: Homebrew decidedly does not include packages for programming languages which have their own packaging system (rubygems/pip/cpan…) or for software for which an arguably more appropriate OS X installer is available (MacTeX). Also, duplicates and older versions are not in the default repo but includes in alternate tap repos. Compare this to macports, which, eg contains an IPython port for all included Python versions. It is kind of a different philosophy which naturally increases the number of packages in macports.
    – Debilski
    Commented Nov 17, 2013 at 12:42
  • 2
    Excellent link! terrychay.com/article/macports-vs-homebrew.shtml Thank you! Commented Oct 19, 2014 at 20:51
  • 1
    @YaOz, Surely you could change homebrew to use something else other than /usr/local?
    – Pacerier
    Commented Nov 1, 2017 at 22:03
  • 4
    No one points out one of Homebrew's major problems... it is a single-user system. MacPorts is not. Commented Feb 26, 2022 at 18:28
  • 2
    I like homebrew, but the single-user idea occasionally is a problem. Two or more times, I have had to go through a bit of a repair hassle because I broke it by doing a brew command from the wrong account.
    – WGroleau
    Commented Dec 19, 2022 at 23:47
53

Just to add some of my own thoughts that seem true-ish circa late 2014 at least.

Homebrew, as of a couple of years ago, definitely has the upper hand in terms of mindshare. You'll find a lot of blogs with people talking about how much happier they are with Homebrew - usually because of the whole "MacPorts pulls in the whole world" vs "Homebrew makes use of what you already have" thing.

However, IMO, MacPorts is a different beast now than it was a couple of years ago. When I first switched to OS X & was using MacPorts the MP philosophy was indeed frustrating because almost everything was built from source. A new installation was particularly painful/slow. However over the past year or so, based purely on my own impressions, it seems like 90% of MP packages are binaries & so installation is actually really fast now. From what I gather Homebrew is also moving in this direction with "Bottles" but i get the impression that most things you install via HB at this point in time will be compiled from source.

So, if only to offer a countervailing opinion, MacPorts seems to actually be the "faster " option these days. However most peoples opinions of MP seem to be based on experiences from circa 2011-12 or so & don't really take this into account. Take this with a grain of salt though as I'm not a regular HB user (and its rather painful to use both side by side).

I do think HB has advantages that mean it will probably "win the war" in the long run though

  • HB is all Ruby whereas MacPorts, and its package formulae, are written in TCL which is....not exactly a popular scripting language. That said its pretty damn simple to create your own portfile.
  • HB is based around GitHub & thus seems a lot more welcoming to new contributors whereas MacPorts hosts its own SVN repository somewhere I think - which basically reflects the different ages of both projects I suppose.
  • HB and Macports now both use Github to manage their formulae, portfiles and source code to provide their functionality.
  • As mentioned the general consensus is that MacPorts has been superseded by HB &, rightly or wrongly, that draws more people towards it.

Otherwise YaOZl & kLy covered the main difference in terms of sudo, dependencies etc pretty well. Personally I do find that MacPorts sometimes leads to some headaches in terms of other programs not expecting anything to be in /opt/local, things being installed with root permissions etc & there are some things that are generally best not installed with MacPorts (e.g. you can install Rails via MacPorts but you'd be crazy not to install it via Ruby's normal Gem management). Other than that though I'm a big fan of the MacPorts philosophy of building its own little world & not relying on some prepackaged OS X library - when it works, and it mostly does, everything is dead simple. Which is what you want of a Package Manager really. And as i mentioned, at this point in time its pretty damn quick to set most things up.

Hope some of that was useful.

3
  • 3
    "As mentioned the general consensus is that MacPorts has been superseded by HB &, rightly or wrongly, that draws more people towards it." ... this feels like a very superficial statement... being popular vs providing quality are not the same and by no means imply the second is "superseded" by the first. Commented Jul 30, 2019 at 7:33
  • 4
    MacPorts is now using Github. See guide.macports.org/#project.github: "The MacPorts project uses the Git distributed version control system to manage the code for the entire project. Our master repositories are hosted on GitHub. We maintain public repositories for almost all our project code and documentation, including a GitHub repository for the MacPorts system itself, for the MacPorts ports, and even for the guide you are reading right now." Commented Feb 23, 2020 at 11:01
  • 2
    MacPorts strategy make more sens with Apple being unreliable about the lib they will distribute in their "next version".
    – gagarine
    Commented Oct 17, 2021 at 14:45
30

Something which other answers (so far) don't appear to have mentioned is that MacPorts has excellent support for legacy versions of macOS. Homebrew only supports the OS's that are currently supported by Apple, which usually means the last three releases. For example, as of February 2022, only Monterrey, Big Sur, and Catalina are compatible with Homebrew.

By contrast, MacPorts can be installed on Tiger (!), and the project maintains special patches to keep software working wherever possible. This includes a "Legacy Support" library which backports functions from newer versions of macOS to older ones; linking against this library while compiling can make a variety of new software suddenly work on older systems!

So, if you're running an old version of macOS, or if you think you may need to stay on a current OS past Apple's expiration date, you should probably go with MacPorts.

6

I am in China and visiting github often fails, which makes installing brew quite a pain. I know some brew mirror in China, so I raised an issue against brew Provide an easy way to change homebrew's origins. They fixed it in 2.3. But even with that installing brew is still not smoothing, e.g. I hit several times that after installation, brew can't find any formula.

qiulang@qiulangdeMacBook-Air redis % brew info wget
Error: No available formula with the name "wget".
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
qiulang@qiulangdeMacBook-Air redis % brew info redis
Error: No available formula with the name "redis".
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.

Now I know I need to "re-tap" but during those times I just didn't know the exact reason except installing brew was not successful.

Out of desperation I switched macports and it works quite smoothly so far.

1

I've had a slightly better experience with Macports, it feels more like a Linux PM (Package Manager), slightly more performant and predictable, compared to Homebrew.

One disadvantage is that it wants to use sudo, just like a Linux PM.

I prefer to download "vanilla" libraries than use the one bundled with OSX, which in my experience would be modified forks and sometimes become obsolete and locked in weird ways.

I like the brew concept of "sandboxes" however again I'd go for the Linux way of doing things if I can choose.

So it depends on your preferences in the end.

0

Brew was completely smooth for me to use, so I'm unable to tell about its cons. Some disadvantages of MacPorts:

There are several very popular questions about the first two points.

5
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – bmike
    Commented Feb 26, 2022 at 16:18
  • 1
    It is false that you have to have a CC in order to establish an AppleID and download Xcode from the developer site. Just built one to test. Commented Feb 26, 2022 at 18:22
  • @MarcWilson thanks for the update. I was asked a credit card back in 2015 and I didn't find a way to do without. I'm unable to test the new conditions now. (They might also be country-specific; I'm in EU.)
    – Nemo
    Commented Feb 28, 2022 at 5:41
  • Actually, I think there was a misunderstanding. In 2015 I wrote that there were two alternatives, either a developer account or App Store. Only the developer account required credit card. I don't know what the requirements are these days.
    – Nemo
    Commented May 29, 2023 at 10:54
  • You only need the XCode Tools, which does not require a full XCode install nor any account/etc. As per the install instructions, just run xcode-select --install. And Homebrew also depends on them: docs.brew.sh/Installation#macos-requirements. Commented Aug 21 at 19:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .