To download a file from the internet using the terminal on macOS, you can use the curl
command. The curl
command is a widely used utility for transferring data from or to a server using various protocols, including HTTP, HTTPS, FTP, and more.
To download a file using curl
, you will need to specify the URL of the file that you want to download, as well as the location where you want to save the file. For example, to download a file called "example.zip" from "https://www.example.com" and save it to the current directory, you can use the following command:
curl -o example.zip https://www.example.com/example.zip
The -o
option specifies the name and location of the file that you want to save the downloaded data to. In this example, the file will be saved as "example.zip" in the current directory.
You can also use the -O
option to save the file using the same name as the original file on the server. For example, to download the file "example.zip" and save it using the same name as the original file, you can use the following command:
curl -O https://www.example.com/example.zip
The curl
command has many other options that you can use to customize the download process, such as specifying a username and password for authentication, setting a maximum download speed, and more. You can find a full list of options by running the curl
command with the --help
option.