owzim
owzim

Reputation: 925

SFTP Support for curl on OSX

I am trying to get SFTP support for curl in OSX. I installed curl via

$ brew install curl --with-ssh

and I also symlinked the homebrew version to the /usr/bin via

$ sudo ln -s /usr/local/bin/curl /usr/bin/curl

But I am still getting a

curl: (1) Protocol sftp not supported or disabled in libcurl

when using

$ curl sftp://some.host.com/path/to/file

My endeavor is connected to an issue for the awesome git-ftp https://github.com/resmo/git-ftp/issues/146

What am I doing wrong?

Upvotes: 15

Views: 13529

Answers (3)

CTiPKA
CTiPKA

Reputation: 2974

For now, you can install just 'curl' Formerly known as: curl-openssl with the following command:

brew install curl

and then the command for example:

/opt/homebrew/opt/curl/bin/curl -u user:password sftp://sftp.host.com/Export/file.txt

Source https://formulae.brew.sh/formula/curl

Upvotes: 2

meles
meles

Reputation: 456

Since the --with-libssh2 option was removed from brew, this is the way to go:

brew install curl-openssl

Be aware:

curl is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have curl first in your PATH, run:
  echo 'export PATH="/usr/local/opt/curl/bin:$PATH"' >> ~/.zshrc

or call it directly by using:

/usr/local/opt/curl/bin/curl ...

Upvotes: 4

Daniel Stenberg
Daniel Stenberg

Reputation: 58114

run 'curl -V' and see if SFTP is listed as a supported protocol.

If it isn't, curl needs to be rebuilt with libssh2 to get the support built-in.

Upvotes: 12

Related Questions