1. 程式人生 > >[原創]macOS安裝wget

[原創]macOS安裝wget

mac用了一年多,今天使用wget命令,竟然提示命令不存在。只好下載原始碼進行安裝了。
安裝過程有點曲折:

  • 編譯wget時,提示pkg-config不存在
  • 第一次從git上下載了pkg-config的原始碼,雖然注意到檔名為pkg-config-pkg-config-0.29.2.tar.gz,而非release檔案,又下載了一個老版本的release後,終於找到configure檔案,才知道自己下載錯了。
  • 編譯安裝pkg-config時,使用make && make install 竟然提示沒有許可權。只要按照網上的安裝命令一步步來。

話不多說,直接上安裝命令

pkg-config

下載地址:
詳見我的另外一篇部落格:《軟體開發資源下載》中的【MacOS】-【pkg-config】
安裝命令:

./configure --with-internal-glib
make
make check
make install

直接使用./configure會提示如下錯誤:

checking malloc.h usability... no
checking malloc.h presence... no
checking for malloc.h... no
checking for bash... /bin/bash
checking for default search path for .pc files... ${libdir}/pkgconfig:${datadir}/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
checking for system include path to avoid -I flags... /usr/include
checking for system library path to avoid -L flags... /usr/lib:/lib
configure: creating ./config.lt
config.lt: creating libtool
checking whether to list both direct and indirect dependencies... no
checking for Win32... no
checking if prefix should be redefined at runtime... no
checking if internal glib should be used... no
checking for pkg-config... no
checking for glib-2.0 >= 2.16... no
configure: error: Either a previously installed pkg-config or "glib-2.0 >= 2.16" could not be found. Please set GLIB_CFLAGS and GLIB_LIBS to the correct values or pass --with-internal-glib to configure to use the bundled copy.

wget

下載地址:
詳見我的另外一篇部落格:《軟體開發資源下載》中的【MacOS】-【wget】
安裝命令:

./configure
make && make install

不安裝pkg-config,直接編譯wget時,會提示:

configure: error: in `/Users/candy/Downloads/wget-1.20':
configure: error: The pkg-config script could not be found or is too old.  Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.

Alternatively, you may set the environment variables GNUTLS_CFLAGS
and GNUTLS_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See `config.log' for more details