How to download Firefox via command line FTP

Solution 1:

You can skip the download step, and mount it directly over the internet like so:

hdiutil attach https://ftp.mozilla.org/pub/firefox/releases/43.0.4/mac/en-US/Firefox\ 43.0.4.dmg

Saves a step, time, and storage space!

Solution 2:

ftp access to ftp.mozilla.org was turned off (see this, thanks Davïd). However, you can use curl from the command line:

curl 'https://ftp.mozilla.org/pub/firefox/releases/43.0.4/mac/en-US/Firefox%2043.0.4.dmg' >~/Desktop/'Firefox 43.0.4.dmg'

That gets the latest (as of this writing) US English release for Mac OS X of Firefox.

You can get a directory listing thusly:

curl 'https://ftp.mozilla.org/pub/firefox/releases/43.0.4/mac/'

That outputs HTML, but it's pretty simple HTML, so it shouldn't be a problem reading it to get a different language. You can also chop additional elements off the path, for example if you want a different version:

curl 'https://ftp.mozilla.org/pub/firefox/releases/'