如何在自制软件上安装带有调试支持的 wget?


wget

不支持在自制默认安装上-d。如何在自制软件上安装带有调试支持的 wget?谢谢。

$ wget -d -o/tmp/log -qO- http://httpbin.org/get
Debugging support not compiled in. Ignoring --debug flag.

仅供记录: 卸载 wget 后,请使用以下命令安装它:

brew install wget --with-debug

来源: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb

如果您想使用一种不那么复杂的方法来安装软件包而不是使用Homebrew那么可以尝试MacPorts

$ sudo port install wget
--->  Computing dependencies for wget
--->  Cleaning wget
--->  Scanning binaries for linking errors
--->  No broken files found.  

做!

wget版本的MacPorts支持开箱即用的调试标志(-d):

$ wget -d -o/tmp/log -qO- http://httpbin.org/get
Setting --output-file (logfile) to /tmp/log
Setting --output-file (logfile) to /tmp/log
Setting --quiet (quiet) to 1
Setting --quiet (quiet) to 1
Setting --output-document (outputdocument) to -
Setting --output-document (outputdocument) to -
{
"args": {}, 
"headers": {
"Accept": "*/*", 
"Accept-Encoding": "identity", 
"Connection": "close", 
"Host": "httpbin.org", 
"User-Agent": "Wget/1.19.4 (darwin17.3.0)"
}, 
"origin": "23.198.166.150", 
"url": "http://httpbin.org/get"
}
$ wget --version
GNU Wget 1.19.4 built on darwin17.3.0.

可以通过Homebrew安装带有调试支持的wget。

运行brew edit wget以访问公式代码,在配置部分中添加"--enable-debug",保存,然后运行brew install --build-from-source wget

也可以通过这种方式启用或禁用其他配置选项(如果您在配置中启用库,请不要忘记将库添加到"depends_on"部分)。

它现在默认启用调试,您无需编辑公式或传递标志。

最新更新