2020.09.03 03:05

How to Install and Use wget on Mac

조회 수 53 댓글 0
첨부 '4'


Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄


Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄


wget is a non-interactive command-line utility for download resources from a specified URL. Because it is non-interactive, wget can work in the background or before the user even logs in. The program was designed especially for poor connections, making it especially robust in otherwise flaky conditions. While wget isn’t shipped with macOS, it can be easily downloaded and installed with Homebrew, the best Mac package manager available.

1. Download and Install Homebrew


To install Homebrew, open a Terminal window and execute the following command taken from Homebrew’s website:

You might notice the command called curl, which is a different command-line utility for downloading files from a URL that ships within the Ruby installation included on macOS.

2. Installing wget


Once it has completed installing itself, we will use Homebrew to install wget. In Terminal, run the following command to download and install wget:

You’ll get live updates on the progress of downloading and installing whatever dependencies (software prerequisites) are required to run wget on your system.

If you already have Homebrew installed, be sure to run brew update to get the latest copies of all your formulae.

3. Using wget


The purpose of wget is downloading content from URLs. It’s a quick and simple non-interactive tool for downloading files from any publicly accessible URL.

Download a single file

Like the similar command curl, wget takes a remote resource from a URL and saves it to a specified location on your computer. The command’s structure works like so:

That will save the file specified in the URL to the location specified on your machine. If the -O flag is excluded, the specified URL will be downloaded to the present working directory.

Download a directory recursively

To download an entire directory tree with wget, you need to use the -r/--recursive and -np/--no-parent flags, like so:

This will cause wget to follow any links found on the documents within the specified directory, recursively downloading the entire specified URL path.

That command also includes -e robots=off, which ignores restrictions in the robots.txt file. In general, it’s a good idea to disable robots.txt to prevent abridged downloads.

Other wget Flags

In addition to the flags above, this selected handful of wget’s flags are the most useful:

Controlling the download

  • wget -X /absolute/path/to/directory will exclude a specific directory on the remote server.
  • wget -nH removes the hostname directories. Remember, the hostname is the part of the URL that contains the domain name and ends in a TLD like “.com.” For example, the folder named “” in our previous example would be skipped, starting the download with the “History” directory instead.
  • wget --cut-dirs=# skips the specified number of directories down the URL before starting to download files. For example, -nH --cut-dirs=1  would change the specified path of “” into simply “/xemacs/,” reducing the number of empty parent directories in the local download.
  • wget -R index.html/wget --reject index.html will skip any files matching the specified file name. In this case it will exclude all the index files. The * character can be used as a wildcard, like “*.png,” which would skip all files with the PNG extension.
  • wget -i file specifies target URLs from an input file. The input file must be an HTML file or be parsed as HTML with the additional flag --force-html
  • wget -nc/wget --no-clobber will not overwrite files that already exist in the destination.
  • wget -c/wget --continue will continue downloads of partially downloaded files.
  • wget -t 10 will try to download the resource up to 10 times before failing.

Adjusting the level of logging

  • wget -d enables debugging output.
  • wget -o path/to/log.txt enables logging output to the specified directory instead of displaying the log-in standard output.
  • wget -q turns off all of wget’s output, including error messages.
  • wget -v explicitly enables wget’s default of verbose output.
  • wget --no-verbose turns off log messages but displays error messages.


While that should cover the majority of wget use cases, the downloader is capable of much more. For a full description of wget’s capabilities, you can review wget’s GNU man page online.



List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
196 System/OS Apache CORS 설정 hooni 2020.09.04 60
» System/OS How to Install and Use wget on Mac file hooni 2020.09.03 53
194 System/OS [mac] VirtualBox 실행 스크립트와 bash_profile 설정 file hooni 2020.07.08 209
193 System/OS [linux] wget 명령 사용 예제 hooni 2020.05.26 245
192 System/OS [linux] The Ultimate Wget Download Guide With 15 Awesome Examples hooni 2020.05.26 196
191 System/OS Configure Postfix to Use Gmail SMTP on Ubuntu 18.04 file hooni 2020.02.07 402
190 System/OS RPA란? 어디에 어떻게 쓰이고 누가 만드나? file hooni 2020.01.28 648
189 System/OS SSH Passwordless Login Using SSH Keygen in 5 Easy Steps file hooni 2019.11.22 411
188 System/OS [virtualbox] VirtualBox에 Ubuntu 설치하기 file hooni 2019.11.22 367
187 System/OS Mac에서 Node.js 설치하기 file hooni 2018.09.28 3370
186 System/OS 서버 확장을 위한 두 가지 방법 file hooni 2018.08.29 1108
185 System/OS How to Setup an Email Server on CentOS 7 hooni 2018.04.05 1203
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 17 Next
/ 17