Jump to content

Protocol "sftp" not supported or disabled in libcurl

Go to solution Solved by Yevhen L.,

Recommended Posts

The same error!!!

curl -V:

root > /usr/local/bin curl -V
curl 7.59.0 (x86_64-apple-darwin17.4.0) libcurl/7.59.0 OpenSSL/1.0.2o zlib/1.2.11 libssh2/1.8.0
Release-Date: 2018-03-14
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy


Link to comment
  • 2 years later...

I was also able to get SFTP working again by manually downgrading to 2.8 as described above.  Thanks for that tip.  However, then macOS complained about having an old version, and constantly wanted me to upgrade, which is annoying.  So, I dug in to why 2.9 wouldn't work with SFTP. 

Warning: technical details ahead!  This won't be a slam dunk if you're not comfortable on the command line, or if you don't want to install homebrew.

macOS 10.14.6 ships with version 7.54.0 of curl / libcurl, which you can see by running curl -V in Terminal:

$ curl -V
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

You can also see that the version it ships with does NOT include the sftp protocol (it would have been included on the Protocols line above).

Does Skitch embed libcurl, or does it use the macOS provided version?  We can check, and it turns out it "links" against the macOS shipped version, and does not include its own version.  This is good, because maybe we can get it to use a version that includes sftp!

$ otool -L /Applications/Skitch.app/Contents/MacOS/Skitch | grep -i curl
    /usr/lib/libcurl.4.dylib (compatibility version 7.0.0, current version 9.0.0)

What happens if we install our own version of curl/libcurl, and tell Skitch to use that instead of the macOS provided version?  Will it work?  Turns out yes, it does, for me.

First, install an alternate version of curl using homebrew (google it), or some other method, and find the directory where your new library is installed, like for instance as follows.  Version numbers will almost certainly differ for you.

$ brew install curl
$ ls /usr/local/Cellar/curl/7.73.0/lib
libcurl.4.dylib    libcurl.a    libcurl.dylib    pkgconfig

Second, quit Skitch completely, including the part that runs in the menu bar.  Then, start Skitch on the command line:

$ DYLD_LIBRARY_PATH=/usr/local/Cellar/curl/7.73.0/lib /Applications/Skitch.app/Contents/MacOS/Skitch &

If the version of curl you just installed includes sftp, then it should work.  At least it did for me.  And should, as long as the interface to libcurl doesn't change between what it expects in 7.54.0, and what it gets with the version you install (in my case, 7.73.0).  This will likely be the case for a while, but not indefinitely.

Downside: you always need to start it from the command line with that DYLD_LIBRARY_PATH bit before it.  Remove it from your Login Items because as long as you don't start it with that PATH in there, it'll get the version of libcurl, without sftp, that comes with macOS.  Yeah, that sucks.  It's worth the hassle for me and my workflow.  Maybe not for you.

Finally, the bold among you may try to make that DYLD_LIBRARY_PATH change system wide, or overwrite the version of libcurl that exists in /usr/lib.  I'm not that adventerous.

Link to comment
  • 5 months later...

Nice investigations there Jason.  I went a little further down the rabbit hole and created an apple script using Script Editor, then exported it to SkitchSFTP.app, so now I can add it to my login items.

do shell script "DYLD_LIBRARY_PATH=/usr/local/Cellar/curl/7.77.0/lib /Applications/Skitch.app/Contents/MacOS/Skitch > /dev/null 2>&1 &"
tell application "System Events"
		if exists (window 1 of process "Skitch") then exit repeat
		delay 0.1
	end repeat
	activate application "Skitch"
	keystroke "w" using command down
end tell

This fires up Sketch using our magical DYLD_LIBRARY_PATH value set, loops until it detects that the window is open, then closes it. You'll need to allow SkitchSFTP.app access to "Accessibility" the first time it runs.

HOWEVER as soon as you quit Sketch and use the Sketch Helper to launch it again, it loses the DYLD_LIBRARY_PATH environment variable value.  So basically as long as you don't quit, this solution will work.  I guess you could always just have this in the Dock for easy access in case you accidentally quit.  Just need to get into the habit of pressing ⌘+W instead of ⌘+Q when finished with the editing/sharing dialog.

Whilst I somewhat enjoy these rabbit holes, I do still wish they would get this fixed properly.  We've done most of the work for them :)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...