8

I am attempting to install Firefox on my Mac, which currently does not have a browser. From a bash terminal I have ftp installed and am currently connected to the internet. However, I have been unsuccessful in connecting to their FTP server. How do I go about installing Firefox for my Mac via the command line?

  • Can your client use http protocol? See this Mozilla support issue. – Dɑvïd Jan 16 '16 at 18:34
  • 3
    The Safari browser is a default part of the OS X, did you delete it and if so, curious as to why? – user3439894 Jan 16 '16 at 19:38
  • I was installing it for a friend. Their OS X had safari installed but on the launcher it showed a cancel sign over it, and when attempting to launch it an error would occur in regards to the version of OS X. I thought it may be necessary to update the computer's operating system to the newest version in order to get safari to work, so in the mean time I just installed firefox to give basic browsing functionality via firefox – John Dream Jan 16 '16 at 22:01
  • You may be able to launch Safari anyway by starting the binary from a shell. Inside the app there is contents/MacOS/Safari which when started from a shell (e.g. bash) often bypasses restrictions launchservices might impose (such as rules from info.plist). If the app is broken that won't work of course. – John Keates Jan 17 '16 at 4:50
  • I'll give it a try next time I have the computer in front of me, I'm familiar with launching binaries in linux so I imagine it is very similar. However, it is likely the app could be broken. – John Dream Jan 18 '16 at 16:31
15

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!

  • That's pretty neat! :) +1 – user3439894 Jan 16 '16 at 21:51
  • It's one of those hidden gems that Apple sneaks in. I tried attaching directly over the internet like that many years back to see if it would work, and it actually did. Definitely a neat trick. ;) Of course, I realized afterwards that it's mentioned in the man page. Heh. – William T Froggard Jan 16 '16 at 22:00
  • You're mounting it over HTTP, which is pretty insecure. Does the command support HTTPS ? – André Borie Jan 17 '16 at 14:30
  • Fair point. Fixed! Yes, it does support HTTPS. – William T Froggard Jan 17 '16 at 14:30
8

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/'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .