14

Use ftp to obtain source code.

I am following a linux command line book to learning compiling.

[me@linuxbox src]$ ftp ftp.gnu.org 
Connected to ftp.gnu.org. 
220 GNU FTP server ready.

I tried and it reported an error

$ ftp ftp://ftp.gnu.org/
-bash: ftp: command not found
$ ftp 
-bash: ftp: command not found

How to solve the problem?

  • BTW, ftp.gnu.org can be acesses via http as well. Open http://ftp.gnu.org in Safari or any other browser. – lhf Nov 8 '18 at 21:17
  • ftp is depreciated as being not secure so ou should be uing newer tools.So a newer tutorial would help. Also using a Linux tutorial on OSX will cause you problems as the OSs differ. For example to compile C programs I would use clang on macOS whoc you get as part of Xcode. – Mark Nov 8 '18 at 22:36
24

macOS does not come with an FTP command line tool. You can connect, read-only, to FTP servers using Finder. Open Finder and choose Go → Connect to Server (⌘K or ) and enter ftp://ftp.gnu.org/.

When prompted for a username and password, choose Guest if the server does not require authentication, which is the case with ftp.gnu.org.

If you do need ftp on the command line, you can install ftp using Homebrew:
brew install inetutils.

8

Edit:

I didn't see the last part of @grg's answer: brew install inetutils is even better. It installs those old school GNU network utilities, acessible from the command line:

- dnsdomainname
- ftp
- rcp
- rexec
- rlogin
- rsh
- telnet

If you want to have the "old-school" feeling of a ftp session into the Terminal, you can install ncftp with Homebrew:

~/ $ brew install ncftp
==> Downloading https://homebrew.bintray.com/bottles/ncftp-3.2.6.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring ncftp-3.2.6.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/ncftp/3.2.6: 16 files, 1.3MB

~/ $ ncftp ftp.gnu.org
NcFTP 3.2.6 (Dec 04, 2016) by Mike Gleason (http://www.NcFTP.com/contact/).

Copyright (c) 1992-2016 by Mike Gleason.
All rights reserved.

Connecting to 209.51.188.20...                                                                                           
GNU FTP server ready.
Logging in...                                                                                                            
NOTICE (Updated October 13 2017):

Because of security concerns with plaintext protocols, we still
intend to disable the FTP protocol for downloads on this server
(downloads would still be available over HTTP and HTTPS), but we
will not be doing it on November 1, 2017, as previously announced
here. We will be sharing our reasons and offering a chance to
comment on this issue soon; watch this space for details.

If you maintain scripts used to access ftp.gnu.org over FTP,
we strongly encourage you to change them to use HTTPS instead.

---

Due to U.S. Export Regulations, all cryptographic software on this
site is subject to the following legal notice:

    This site includes publicly available encryption source code
    which, together with object code resulting from the compiling of
    publicly available source code, may be exported from the United
    States under License Exception "TSU" pursuant to 15 C.F.R. Section
    740.13(e).

This legal notice applies to cryptographic software only. Please see
the Bureau of Industry and Security (www.bxa.doc.gov) for more
information about current U.S. regulations.
Login successful.
Logged in to ftp.gnu.org.

ncftp / > cd /gnu/diction
Directory successfully changed.
ncftp /gnu/diction > ls
diction-0.7.tar.gz            diction-1.02.tar.gz           diction-1.11.tar.gz           diction-1.11.tar.gz.sig

ncftp /gnu/diction > get diction-1.11.tar.gz
diction-1.11.tar.gz:                                   137.76 kB  118.63 kB/s  
ncftp /gnu/diction > bye

I came here, because I too, am following the classic (and excellent) book "The Linux Command Line", and just reached the chapter about compilation.

It might be old, depreciated and unsecure, but it still feels geek and great.

  • Much better than accepted answer – hmedia1 Jun 22 at 17:43
2

You can open ftp://ftp.gnu.org/ in Firefox and Chrome without going to the Finder, which is what Safari does.

If you have a complete URL to download, use curl, as in

curl -L -R -O ftp://ftp.gnu.org/gnu/bc/bc-1.07.1.tar.gz

Do man curl or curl --help for more information.

You must log in to answer this question.

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