wget Command on macOS Terminal


mac ~ % wget
zsh: command not found: wget

If you try the wget command on your Mac you would get a command not found error, that's because you would need to install the wget package.

How to install wget in macOS?

  • Open Terminal App,
  • Type command: brew install wget

If you do not have brew installed: follow this article: How to install brew on Mac (M1)

Examples: wget

@mac ~ % wget https://code2care.org
--2021-08-08 14:28:40--  https://code2care.org/
Resolving code2care.org (code2care.org)... 104.21.91.10, 172.67.164.66
Connecting to code2care.org (code2care.org)|104.21.91.10|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html’

index.html     [ <=> ]  35.74K  --.-KB/s    in 0.02s   

2021-08-08 14:28:40 (2.16 MB/s) - ‘index.html’ saved [36601]

You can know more about the command by using the help "wget --help"

wget --help
GNU Wget 1.21.1, a non-interactive network retriever.
Usage: wget [OPTION]... [URL]...

Mandatory arguments to long options are mandatory for short options too.

Startup:
  -V,  --version                   display the version of Wget and exit
  -h,  --help                      print this help
  -b,  --background                go to background after startup
  -e,  --execute=COMMAND           execute a `.wgetrc'-style command

If you provide an invalid URL you will get an unable to resolve address error,

If you do not provide a URL you will get an error,

mac ~ % pwd
/Users/code2care
code2care@mac ~ % cd Desktop 
code2care@mac Desktop % wget abc
--2021-08-08 14:31:47--  http://abc/
Resolving abc (abc)... failed: nodename nor servname provided, or not known.
wget: unable to resolve host address ‘abc’
mac Desktop % wget abc
--2021-08-08 14:31:47--  http://abc/
Resolving abc (abc)... failed: nodename nor servname provided, or not known.
wget: unable to resolve host address ‘abc’
Advertisements
Try Out Code2care Dev Tools:

Advertisements



Android Java Linux Microsoft Google Python macOS Notepad++ Microsoft Teams CSS PHP SharePoint Html Linux C Programs Bootstrap jQuery Sublime Android Studio Facebook Eclipse WhatsApp News MySQL Json HowTos JavaScript FTP S3


Advertisements


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Tutorials, Trouble-Shooting steps, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.
🎉 We are celebrating the 10th years of Code2care! Thank you for all your support! We hope we made a difference.
We strong support Gender Equality & Diversity.

We stand in solidarity with Ukraine - Make a donation to UNHCR - https://donate.unhcr.org/in/en-in/ukraine-emergency