Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Building GnuTLS on Mac OS X

Preparing the Build Environment

cd ~/Desktop
mkdir wget-build
cd wget-build

Building & Installing GMP 5.0.2

curl -O
tar xjf gmp-5.0.2.tar.bz2
pushd gmp-5.0.2
CC=gcc-4.2 CXX=g++4.2 ./configure --prefix=/usr/local
sudo make install

Building & Installing Libnettle 2.4

curl -O
tar xzf nettle-2.4.tar.gz
pushd nettle-2.4
CFLAGS="-m64" ./configure --prefix=/usr/local --disable-assembler
sudo make install

Building & Installing GnuTLS 2.12.12

curl -O
tar xjf gnutls-2.12.12.tar.bz2
pushd gnutls-2.12.12
CFLAGS="-m64" CXXFLAGS="-m64" ./configure --prefix=/usr/local --without-p11-kit
sudo make install
Copy link

grok commented Jun 22, 2013

First, use curl to download the latest wget source:
curl -O

Next we use tar to uncompress the files you just downloaded:
tar -xzf wget-1.13.4.tar.gz

Use cd to change to the directory:
cd wget-1.13.4

Configure with the appropriate –with-ssl flag to prevent a “GNUTLS not available” error:
./configure --with-ssl=openssl

Build the source:

Install wget, it ends up in /usr/local/bin/:
sudo make install

Confirm everything worked by running wget:
wget --help

Clean up by removing wget source files when finished:
cd .. && rm -rf wget*

Copy link

retrocar66 commented Oct 23, 2013

This worked for me.

Why does setting --with-ssl prevent the error? Does it just remove the GNUTLS dependency?

Copy link

mario-grgic commented Nov 15, 2013

./configure --with-ssl=openssl

Apple OpenSSL implementation already has TSL library.

Copy link

francwalter commented Jun 30, 2016

I run into an error when try to make nettle-2.4 on my MacBook with OS 10.11.5:

In file included from /usr/local/include/gmp.h:50:
/Applications/ error: no member named
      'ptrdiff_t' in the global namespace
using ::ptrdiff_t;
1 error generated.

I could compile the previous library (GMP 5.0.2) but I had to install gcc-4.2 through brew, the hint from @jaycode (from 12 Jun 2012) didn't help, there was no more 4.2 on my system, I guess this is too old.
What could I do? I don't understand this error.
Or is there another way to get gnutls on Mac OS 10.11.5?

EDIT 2016-07-04: never mind, I let go my plan of compiling inadyn on Mac, where I need gnutls. There are too many other issues anyway.

Copy link

9p4 commented Aug 10, 2017

On mac, you have to change the command: CC=gcc-4.2 CXX=g++4.2 ./configure --prefix=/usr/local
to CC=gcc CXX=g++ ./configure --prefix=/usr/local

Copy link

impactanalysts commented Sep 14, 2017

With macos 10.12.6, I could install GMP, but not Nettle. After running configure and make, I ran make check. The result was:
88 of 89 tests failed

For one thing, it complained that libhogweed.4.dylib could not be found. I tried to attach the history of my installation attempt (starting with curl), and the output of make check to this post as a file, but every time I tried I got an upload error ("We don't support that file type"), even though I tried txt, zip, and pdf versions of the file. So I created a GH repo where you can view the file, here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment