I tried
brew install gmp@4
but it explained
No available formula with the name "gmp4"
I have gmp6 on macOS Catalina but I need gmp4 for some reasons, so how to install gmp4 on macOS Catalina?
Extract the file and enter the directory.
CFLAGS="-O3 -w -pipe -arch x86_64"
CXXFLAGS="-O3 -w -pipe -arch x86_64"
LDFLAGS="-arch x86_64"
./configure --prefix=/usr/local/Cellar/gmp/4.3.2 --enable-cxx --build=x86_64-apple-darwin
make
make install
It will install gmp-4.3.2 in /usr/local/Cellar/gmp/4.3.2, enjoy!