阅读更多
转帖:http://community.itbbs.cn/thread/21327/
今天更新brew安装的软件,结果悲剧产生了,sourceforge.net被墙了!!
我们以libpng为例进行解决,其他软件方法一样。
sh-3.2# brew upgrade
==> Upgrading 6 outdated packages, with result:
libpng 1.5.12, imagemagick 6.7.7-6, libtiff 4.0.2, pcre 8.31, lighttpd 1.4.31, wget 1.14
==> Upgrading libpng
==> Downloading http://downloads.sf.net/project/libpng/libpng15/1.5.12/libpng-1.5.12.tar.gz
curl: (56) Recv failure: Connection reset by peer
Error: Download failed: http://downloads.sf.net/project/libpng/libpng15/1.5.12/libpng-1.5.12.tar.gz
很明显,下载软件失败,我们找另一个软件包地址把sf.net上的替换掉。
执行命令:
# brew edit libpng
会提示编辑ruby源代码,编辑器是vim,内容如下。
require 'formula'
class Libpng < Formula
homepage 'http://www.libpng.org/pub/png/libpng.html'
#url 'http://downloads.sf.net/project/libpng/libpng15/1.5.12/libpng-1.5.12.tar.gz'
url 'ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.5.12.tar.gz'
sha1 'c329f3a9b720d7ae14e8205fa6e332236573704b'
keg_only :provided_by_osx if MacOS::X11.installed?
def install
system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}"
system "make install"
end
end
很明显我用ftp.simplesystems.org替换了downloads.sf.net的文件地址。
接下来保存好内容,继续brew,成功!