curl not bring installed to /usr/local/bin with homebrew

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.


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)).