Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Why is sftp not supported in macOS Mojave curl?

In macOS Mojave, curl doesn't support sftp:


curl 7.54.0 (x86_64-apple-darwin18.0) libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy 


I've searched and it appears that you have to reinstall curl with libssh2 but the following didn't work:


brew install curl --with-libssh2


from this link: https://try2explore.com/questions/11680460


The error message was:

Error: invalid option: --with-libssh2


I also have a Mac running Catalina and curl (7.64.1) does not support sftp.


  1. Is there an easy way to add sftp support to curl?
  2. Will the upcoming macOS add sftp support back?


Thanks

MacBook Pro 13″, macOS 10.14

Posted on Aug 20, 2021 9:36 AM

Reply
Question marked as Best reply

Posted on Aug 20, 2021 10:01 AM

One of the dependencies of brew install curl is libssh2 and that will be automatically built and linked into the brew installed curl. Thus, from brew info curl, you will note that there are no optional build switches supported.


As you will be building curl 7.78.0 or later, be certain that your PATH has /usr/local/bin:$PATH so that you will pick up the brew installed curl and not the one Mojave installed. Once your path is adjusted, you should look at the man page for curl v7.78.0 and search for SFTP.


We cannot discuss macOS Monterey here as it is a beta product.

Similar questions

4 replies
Question marked as Best reply

Aug 20, 2021 10:01 AM in response to mba314159

One of the dependencies of brew install curl is libssh2 and that will be automatically built and linked into the brew installed curl. Thus, from brew info curl, you will note that there are no optional build switches supported.


As you will be building curl 7.78.0 or later, be certain that your PATH has /usr/local/bin:$PATH so that you will pick up the brew installed curl and not the one Mojave installed. Once your path is adjusted, you should look at the man page for curl v7.78.0 and search for SFTP.


We cannot discuss macOS Monterey here as it is a beta product.

Aug 20, 2021 11:09 AM in response to VikingOSX

VikingOSX wrote:

One of the dependencies of brew install curl is libssh2 and that will be automatically built and linked into the brew installed curl. Thus, from brew info curl, you will note that there are no optional build switches supported.

As you will be building curl 7.78.0 or later, be certain that your PATH has /usr/local/bin:$PATH so that you will pick up the brew installed curl and not the one Mojave installed. Once your path is adjusted, you should look at the man page for curl v7.78.0 and search for SFTP.

We cannot discuss macOS Monterey here as it is a beta product.


VikingOSX—for clarification can you comment here...


It seems in zsh macOS Big Sur —by default sFTP is supported... or am I mistaken(?)

man curl | more


(This of course would be independent of the OP's libssh2 )

Aug 20, 2021 12:33 PM in response to leroydouglas

One adds SSH2 (SFTP) support in curl by linking it with a third-party library libssh2. Apparently, not invented here won out because the curl in macOS Big Sur does not appear to support SFTP from the protocol list below:


curl -V
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp


If you have a local known IP address, the following will also tell you that Protocol "sftp" not supported or disabled in libcurl


curl -k "sftp://nnn.nnn.nnn.nnn"
curl: (1) Protocol "sftp" not supported or disabled in libcurl



So, I would say that Apple chose to not provide SFTP support in /usr/bin/curl with Big Sur 11.5.2.

Why is sftp not supported in macOS Mojave curl?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.