ファイルのダウンロードをGUIでやってもいいんですが、Wgetでやったほうが楽だなと思い、MBAにWgetを入れちゃいました。
手順
①インストールに使うtar.gzファイルをDL
今回は、下記のパスからファイルをDLしました。
http://ftp.gnu.org/pub/gnu/wget/wget-1.15.tar.gz
②展開します
MBA:Desktop $ tar xvzf wget-1.15.tar.gz
x wget-1.15/
x wget-1.15/build-aux/
x wget-1.15/build-aux/compile
x wget-1.15/build-aux/announce-gen
x wget-1.15/build-aux/missing
x wget-1.15/build-aux/config.sub
x wget-1.15/build-aux/install-sh
x wget-1.15/build-aux/vc-list-files
x wget-1.15/build-aux/snippet/
x wget-1.15/build-aux/snippet/warn-on-use.h
x wget-1.15/build-aux/snippet/_Noreturn.h
x wget-1.15/build-aux/snippet/c++defs.h
x wget-1.15/build-aux/snippet/arg-nonnull.h
x wget-1.15/build-aux/gnupload
x wget-1.15/build-aux/git-version-gen
x wget-1.15/build-aux/depcomp
x wget-1.15/build-aux/build_info.pl
x wget-1.15/build-aux/useless-if-before-free
・
・
・
x wget-1.15/doc/sample.wgetrc.munged_for_texi_inclusion
MBA:Desktop $
③OpenSSLインストールされているか確認します
MBA:wget-1.15 $ openssl version
OpenSSL 0.9.8zf 19 Mar 2015
MBA:wget-1.15 $
④コンパイルします
MBA:wget-1.15 $ ./configure --with-ssl=openssl
configure: configuring for GNU Wget 1.15
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... build-aux/install-sh -c -d
・
・
・
MBA:wget-1.15 $ make
/Library/Developer/CommandLineTools/usr/bin/make all-recursive
Making all in lib
・
・
・
make[2]: Nothing to be done for `all'.
make[2]: Nothing to be done for `all-am'.
:wget-1.15 $
⑤インストールします
MBA:wget-1.15 $ sudo make install
Password:
/Library/Developer/CommandLineTools/usr/bin/make install-recursive
Making install in lib
/Library/Developer/CommandLineTools/usr/bin/make install-recursive
if test no = no; then \
・
・
・
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
MBA:wget-1.15 $
⑥インストールされたか確認します
MBA:wget-1.15 $ which wget
/usr/local/bin/wget
MBA:wget-1.15 $ wget -V
GNU Wget 1.15 built on darwin14.4.0.
+digest +https +ipv6 -iri +large-file -nls +ntlm +opie +ssl/openssl
Wgetrc:
/usr/local/etc/wgetrc (system)
Compile:
gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/usr/local/etc/wgetrc"
-DLOCALEDIR="/usr/local/share/locale" -I. -I../lib -I../lib -O2
-Wall
Link:
gcc -O2 -Wall -liconv -lssl -lcrypto -ldl -lz ftp-opie.o openssl.o
http-ntlm.o ../lib/libgnu.a
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://www.gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Originally written by Hrvoje Niksic <hniksic@xemacs.org>.
Please send bug reports and questions to <bug-wget@gnu.org>.
MBA:wget-1.15 $
⑦使ってみます
MBA:~ $ wget http://jmba-tohoku.org/common_img/img_title.png
--2015-08-29 16:27:23-- http://jmba-tohoku.org/common_img/img_title.png
Resolving jmba-tohoku.org... 60.43.210.59
Connecting to jmba-tohoku.org|60.43.210.59|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 376881 (368K) [image/png]
Saving to: 'img_title.png'
100%[======================================>] 376,881 1.54MB/s in 0.2s
2015-08-29 16:27:24 (1.54 MB/s) - 'img_title.png' saved [376881/376881]
MBA:~ $
MBA:~ $ echo $?
0
MBA:~ $
★正常にgetできました!
これでシェルの中でファイルをゲットしたり、いろいろ自動化できます。