0

I'm trying to install the latest version of curl with homebrew, but it doesn't seem to be working.

I installed it with the following command and it seems to happen successfully:

$ brew install curl

To add /usr/local/bin to my PATH, I ran the following command:

$ echo 'export PATH="/usr/local/opt/curl/bin:$PATH"' >> ~/.zshrc

However, curl still was on the old version, and running which curl would point to /usr/bin/curl. I tried to see if there was anything in /usr/local/bin, but was surprised by the output:

$ which /usr/local/bin/curl
/usr/local/bin/curl not found

Sure enough, there was no symlink in /usr/local/bin. What am I doing wrong? I am on macOS Catalina.

0

1 Answer 1

3

The message Homebrew shows you after installing curl gives you all the required details

==> Caveats
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"' >> /Users/pse/.bash_profile

For compilers to find curl you may need to set:
  export LDFLAGS="-L/usr/local/opt/curl/lib"
  export CPPFLAGS="-I/usr/local/opt/curl/include"

For pkg-config to find curl you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/curl/lib/pkgconfig"

So you need to either alias the Homebrew curl so it gets picked up in interactive shells or add its path to PATH as explained in the text above (which explains it for bash, you need to add the respective entry to .zshrc (or wherever zsh takes its paths from)).

7
  • Do you mean I need to put those export commands into my .zshrc file as well? I'm not trying to use curl with a compiler or pkg-config, I'm just trying to use it in the terminal
    – Oion Akif
    Nov 17, 2020 at 17:49
  • @SkeletonBow You need to adjust PATH accordingly (or define an alias for curl).
    – nohillside
    Nov 17, 2020 at 18:03
  • Isn't that what I did with the second command in my question? Or am I missing something here... when I run echo $PATH I get /Users/username/bin:/usr/local/bin:/Users/username/opt/miniconda3/bin...
    – Oion Akif
    Nov 17, 2020 at 18:20
  • @SkeletonBow Did you source your .zshrc afterwards, or open a new Terminal window? Are you using zsh?
    – nohillside
    Nov 17, 2020 at 19:24
  • Yes to both of them. I even checked in my .zshrc file that the first line is export PATH=$HOME/bin:/usr/local/bin:$PATH. It also seems like /usr/local/bin is in my PATH as evidences by running the echo $PATH command. But it looks like homebrew just doesn't create a symlink for curl in /usr/local/bin...
    – Oion Akif
    Nov 17, 2020 at 19:27

You must log in to answer this question.

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