我最近刚从Ubuntu换到Mac。我很失望mac在Ubuntu中没有方便的sudo apt-get。我听说我应该使用自制的,但我不确定自制的或macports做什么?


当前回答

MacPorts是正确的选择。

Like @user475443 pointed, MacPorts has many many more packages. With brew you'll find yourself trapped soon because the formula you need doesn't exist. MacPorts is a native application: C + TCL. You don't need Ruby at all. To install Ruby on Mac OS X you might need MacPorts, so just go with MacPorts and you'll be happy. MacPorts is really stable, in 8 years I never had a problem with it, and my entire Unix ecosystem relay on it. If you are a PHP developer you can install the last version of Apache (Mac OS X uses 2.2), PHP and all the extensions you need, then upgrade all with one command. Forget to do the same with Homebrew. MacPorts support groups. foo@macpro:~/ port select --summary Name Selected Options ==== ======== ======= db none db46 none gcc none gcc42 llvm-gcc42 mp-gcc48 none llvm none mp-llvm-3.3 none mysql mysql56 mysql56 none php php55 php55 php56 none postgresql postgresql94 postgresql93 postgresql94 none python none python24 python25-apple python26-apple python27 python27-apple none If you have both PHP55 and PHP56 installed (with many different extensions), you can swap between them with just one command. All the relative extensions are part of the group and they will be activated within the chosen group: php55 or php56. I'm not sure Homebrew has this feature. Rubists like to rewrite everything in Ruby, because the only thing they are at ease is Ruby itself.

其他回答

MacPorts是正确的选择。

Like @user475443 pointed, MacPorts has many many more packages. With brew you'll find yourself trapped soon because the formula you need doesn't exist. MacPorts is a native application: C + TCL. You don't need Ruby at all. To install Ruby on Mac OS X you might need MacPorts, so just go with MacPorts and you'll be happy. MacPorts is really stable, in 8 years I never had a problem with it, and my entire Unix ecosystem relay on it. If you are a PHP developer you can install the last version of Apache (Mac OS X uses 2.2), PHP and all the extensions you need, then upgrade all with one command. Forget to do the same with Homebrew. MacPorts support groups. foo@macpro:~/ port select --summary Name Selected Options ==== ======== ======= db none db46 none gcc none gcc42 llvm-gcc42 mp-gcc48 none llvm none mp-llvm-3.3 none mysql mysql56 mysql56 none php php55 php55 php56 none postgresql postgresql94 postgresql93 postgresql94 none python none python24 python25-apple python26-apple python27 python27-apple none If you have both PHP55 and PHP56 installed (with many different extensions), you can swap between them with just one command. All the relative extensions are part of the group and they will be activated within the chosen group: php55 or php56. I'm not sure Homebrew has this feature. Rubists like to rewrite everything in Ruby, because the only thing they are at ease is Ruby itself.

默认情况下,Homebrew将包安装到您的/usr/local。Macport命令需要sudo来安装和升级(类似于Ubuntu中的apt-get)。

详情如下:

这个网站建议使用Hombrew: http://deephill.com/macports-vs-homebrew/

而这个网站列出了使用Macports的优点:http://arstechnica.com/civis/viewtopic.php?f=19&t=1207907

我最近也从Ubuntu换了,我喜欢使用自制的(它简单易用!),但如果你喜欢使用sudo, Macports可能是更好的选择!

Homebrew和macports都解决了同样的问题——那就是安装没有与osx捆绑的公共库和实用程序。

通常这些是与开发相关的库,这些工具最常见的用途是用于osx的开发人员。

它们都需要安装xcode命令行工具(你可以从https://developer.apple.com/单独下载),对于某些特定的包,你需要安装整个xcode IDE。

xcode可以从mac应用商店安装,它是免费下载的,但它需要一段时间,因为它大约5GB(如果我没记错的话)。

macports是来自BSD的端口实用程序的osx版本(因为osx源自BSD,这是一个自然的选择)。对于任何熟悉BSD发行版的人来说,macports都是很熟悉的。

One major difference between homebrew and macports; and the reason I prefer homebrew is that it will not overwrite things that should be installed "natively" in osx. This means that if there is a native package available, homebrew will notify you instead of overwriting it and causing problems further down the line. It also installs libraries in the user space (thus, you don't need to use "sudo" to install things). This helps when getting rid of libraries as well since everything is in a path accessible to you.

Homebrew还拥有更活跃的用户社区,它的软件包(称为公式)也经常更新。


macports不会覆盖原生OSX包——它提供自己的包 版本-这是我更喜欢macports而不是自制的主要原因 你需要确定你在使用什么,以及苹果的变化 不同时间的港口,已经知道是落后的岁月 部分项目更新 你能给出一个macports覆盖本机OS X的参考吗 包吗?据我所知,所有的macports安装都是在 / opt /本地

也许我应该澄清一下——在我的回答中,我并没有说macports会覆盖OSX本机包。它们都分别安装项目。

为了更好的兼容性,当你应该“本地”安装(使用库/工具的首选安装程序)时,Homebrew会警告你。这就是我的意思。它还将使用尽可能多的OS x中可用的本地库。

我们真的不喜欢家酿/家酿的傻瓜 然而,我们确实喜欢被愚弄的人! OS X附带的东西或者是由 RubyGems, CPAN或PyPi不应该被欺骗。有很好的理由 这样的: 重复的库经常破坏构建 细微的错误会出现在重复的库中,在较小程度上,重复的工具也会出现 我们希望你能更努力地让你的公式适用于OS X自带的东西

您可以选择用自制工具覆盖macosx提供的实用程序版本。

目前,由于其成熟度,Macports的软件包(~18.6 K)比Homebrew公式(~3.1K)多得多。不过,Homebrew正在慢慢赶上来。

Macport包往往由一个人维护。

Macports可以保留多个版本的包,你可以启用或禁用它们来测试。有时这个列表可能会损坏,您必须手动编辑它以使内容恢复正常,尽管这并不太难。

两个包管理器都要求定期更新。这可能需要一些时间。

注意:在您的系统上可以同时拥有两个包管理器!这不是其中之一。Brew可能会抱怨,但Macports不会。

此外,如果您正在处理python或ruby包,尽可能使用虚拟环境。