15

How can I get the newest version of cURL instead of the old 7.24 that Apple provides?

user:~ kevinsimper$ curl --version
curl 7.31.0 (x86_64-apple-darwin12.4.0) libcurl/7.31.0 OpenSSL/0.9.8x zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp 
Features: IPv6 Largefile NTLM NTLM_WB SSL libz 

When I install with Brew I am notified that it is a keg-only and if I do

brew link curl --force

the version is stil 7.24, but the protocols have been updated.

Kuser:~ kevinsimper$ curl --version
curl 7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8x zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp 
Features: AsynchDNS GSS-Negotiate IPv6 Largefile NTLM NTLM_WB SSL libz 
user:~ kevinsimper$ which curl
/usr/bin/curl

If I then delete the "apple" curl, the function is not executable.

user:~ kevinsimper$ curl --version
curl 7.31.0 (x86_64-apple-darwin12.4.0) libcurl/7.31.0 OpenSSL/0.9.8x zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp 
Features: IPv6 Largefile NTLM NTLM_WB SSL libz 
user:~ kevinsimper$ brew install postgresql
==> Installing postgresql dependency: ossp-uuid
==> Downloading ftp://ftp.ossp.org/pkg/lib/uuid/uuid-1.6.2.tar.gz
Error: /usr/bin/curl is not executable
1
  • 4
    Don't delete Apple supplied files - the OS might still use them and it won't use homebrew files. To use the homebrew file you need to set your PATH - see may questions here
    – mmmmmm
    Jul 8 '13 at 11:14
7

Add export PATH=/usr/local/bin:$PATH to your .bashrc for example to use the bin installed with Homebrew.

5
  • 2
    Or .bash_profile. Terminal and iTerm open new shells as login shells by default, so bash doesn't read .bashrc.
    – Lri
    Jul 8 '13 at 17:41
  • Will this cause problems for the system since you're putting the new curl's binary in front of the system's curl binary? Jan 16 '14 at 8:03
  • 1
    Nope since it's only for your terminal session. Jan 16 '14 at 10:07
  • When I do this, it still shows /usr/bin/curl as the result of which curl. Any advice? Oct 31 '16 at 20:23
  • 2
    @MadPhysicist run brew link curl --force to force Homebrew to symlink curl into usr/local/bin. As long as that is ahead of /usr/bin in your path, then the Homebrew curl should be used. Nov 6 '16 at 23:48
1

I installed curl on macOS via Homebrew but curl didn't appear in /usr/local/bin, so from /usr/local I did a search

[/usr/local]$ find . -iname *curl*

which found curl hidden away at

./Cellar/curl/7.77.0/include/curl

and a check of that showed it as executable:

[/usr/local]$ ls -l ./Cellar/curl/7.77.0/bin/curl
-r-xr-xr-x  1 xxxxxx  admin  264776 Jun 21 16:19 ./Cellar/curl/7.77.0/bin/curl

and executing gave the expected version:

[/usr/local]$ ./Cellar/curl/7.77.0/bin/curl --version
curl 7.77.0 (x86_64-apple-darwin19.6.0) libcurl/7.77.0 ...

so there's how I managed to run the brew version. hth

You must log in to answer this question.

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