乐闻世界logo
搜索文章和话题

How to install wget in macOS?

1个答案

1

wget is a widely used network download tool that allows users to download content from the internet via the command line. macOS does not come with wget pre-installed, but it can be installed through several methods. Below, I will detail how to install wget on macOS.

Installing with Homebrew

The simplest way to install wget on macOS is using Homebrew, a package manager for macOS that installs missing software packages.

  1. Install Homebrew: If your computer does not have Homebrew installed, you can install it by executing the following command in the Terminal:

    bash
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

    This command downloads and runs the Homebrew installation script.

  2. Install wget: Once Homebrew is installed, you can install wget with the following command:

    bash
    brew install wget

    This command downloads and installs the latest version of wget from the Homebrew repository.

Installing with MacPorts

If you prefer using MacPorts, another popular macOS package manager, follow these steps to install wget:

  1. Install MacPorts: If you have not installed MacPorts, you can obtain the installation guide from the MacPorts website.

  2. Install wget: After installing MacPorts, you can install wget with the following command:

    bash
    sudo port install wget

    When installing with MacPorts, you may need administrator privileges.

Summary

Using either of the above methods, you can successfully install wget on macOS. Both methods are effective, and the choice depends on your preference. Once installed, you can use the wget command in the Terminal to download files from the internet.

For example, to download a webpage, you can use:

bash
wget http://example.com

This command saves the homepage of example.com to the current directory.

2024年7月30日 00:18 回复

你的答案