4

Is there software for macOS that adds command history, autocompletion or other features to an ftp command line client?

2
  • Apple removed ftp as a command line utility some time ago. It was deprecated as an insecure protocol. I don't think anyone's made a command line replacement; though there are apps like Fetch, CyberDuck, etc. It might be helpful if you explained what you're trying to achieve by using command-line ftp in this way.
    – benwiggy
    Oct 5, 2022 at 13:38
  • actually, I was testing sftp ...but yeah, cyberduck, FZ are fine too
    – jjrr
    Oct 5, 2022 at 13:55

2 Answers 2

3

FTP and SFTP are completely different protocols. There is software that supports both, but it's just a common interface over two completely different things under the hood.

SFTP

SSHFS

The best way to use SFTP is via sshfs, which makes any SFTP server available as a networked filesystem. You can then use ordinary shell commands (with the shell's history and completion) to access remote files.

mkdir myserver
sshfs myserver.example.com:/path/to/root example.com
ls myserver/subdir
cp myserver/subdir/myfile.txt ~
…
fusermount -u myserver

The sshfs software itself is easily available from package repositories such as Brew. The problem with sshfs is that it requires a kernel extension for FUSE, which is fine on Intel Macs, but a pain on Apple Silicon due to the extra kernel integrity protections.

Improving the basic sftp command

You can use rlwrap to give any line-oriented command line software bash-like line editing commands, history, and completion of (local) file names. rlwrap is available from many package repositories including Brew.

FTP

zftp

MacOS comes with a convenient command line FTP client: it's built into zsh, in the zftp module. You get all of zsh's features including command line history and completion (of both local and remote files). FTP commands can be used by prefixing either zftp (e.g. zftp open, zftp ls, …) or just zf (e.g. zfopen, zfls, …).

zmodload zsh/zftp
zfopen ftp.example.com
zfls
zfget myfile.txt
zfclose
1
  • Woah - zsh embedding zmodload for easy install of zftp is a nice tip. +thanks
    – bmike
    Oct 10, 2022 at 13:37
1

I’m all in to use Mountain Duck and Transmit for my ftp needs now that macOS does not ship ftp or telnet or other “vintage” and traditional command line tools. If you’re not into paid, supported software, check out Cyberduck.

If you only need command line ftp and don’t want to compile it yourself, go for homebrew to install tnftp

brew install tnftp

If you might need other tools, the inetutils is a nice option. Also since sftp and ftps are different protocols with similar names, this other Q&A may be helpful.

1
  • Just in case: for FTP transfer, macOS ships with curl command line tool - which has always been a better option than ftp tool.
    – Leo Braun
    May 3, 2023 at 8:47

You must log in to answer this question.

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