'curl: (7) Failed to connect to after ms: Bad file descriptor
My native curl command isn't working anymore when I execute it from my iTerm2 terminal on Mac OS X. I'm using zsh, but even in plain bash, it doesn't work. Strangely when I try the native Terminal app, the same curl version works for both zsh and bash without any problems. Below is the output I get when I try to access google.com
* Trying 108.177.15.138:80...
* connect to 108.177.15.138 port 80 failed: Bad file descriptor
* Trying 108.177.15.100:80...
* connect to 108.177.15.100 port 80 failed: Bad file descriptor
* Trying 108.177.15.113:80...
* connect to 108.177.15.113 port 80 failed: Bad file descriptor
* Trying 108.177.15.139:80...
* connect to 108.177.15.139 port 80 failed: Bad file descriptor
* Trying 108.177.15.102:80...
* connect to 108.177.15.102 port 80 failed: Bad file descriptor
* Trying 108.177.15.101:80...
* connect to 108.177.15.101 port 80 failed: Bad file descriptor
* Failed to connect to google.com port 80 after 48 ms: Bad file descriptor
* Closing connection 0
curl: (7) Failed to connect to google.com port 80 after 48 ms: Bad file descriptor
When I install another version of Curl with Homebrew, I don't have any issues executing that in iTerm2. Does anybody have a clue what the problem might be? Perhaps a permission issue for iTerm2.
Curl
curl 7.79.1 (x86_64-apple-darwin21.0) libcurl/7.79.1 (SecureTransport) LibreSSL/3.3.5 zlib/1.2.11 nghttp2/1.45.1
Release-Date: 2021-09-22
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS GSS-API HSTS HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL UnixSockets
Curl (HomeBrew)
curl 7.82.0 (x86_64-apple-darwin21.3.0) libcurl/7.82.0 (SecureTransport) OpenSSL/1.1.1n zlib/1.2.11 brotli/1.0.9 zstd/1.5.2 libidn2/2.3.2 libssh2/1.10.0 nghttp2/1.47.0 librtmp/2.3 OpenLDAP/2.6.1
Release-Date: 2022-03-05
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL TLS-SRP UnixSockets zstd
Mac OS X
12.3
iTerm2
3.4.15
Solution 1:[1]
For some reasons iTerm have an issue when it's located in the /Applications folder.
If you move it to the /Users/<Your Username>/Applications it works just fine as well as in any other folder than /Applications.
Another interesting fact is that it's even enough to rename the application to make it work. For instance iTerm.app does not work but iTerm 2.app works just fine.
It might be both related to the iTerm or to the system itself. Beta version of iTerm have exactly the same issues.
I was not able to identify what is the reason for such behavior nor relevant ticket in the iTerm repository yet.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
