# Compiling gnu utilities on MacOSX

As someone had pointed out, I was using a gnu sed when modifying the make file for libgsm.
MacOSX does not ship with a gnu sed.

This is how I usually build gnu utilities (and basically, everything else I need and build from source)

As an example, how to build sed is shown:

First, obtain and unpack sed

```\$ /usr/bin/curl -O ftp://ftp.gnu.org/pub/gnu/sed/sed-4.1.5.tar.gz
\$ tar xzpf sed-4.1.5
```

Set up compiler flags

```\$ export CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch x86_64 -arch ppc64 -arch ppc -arch i386 -arch x86_64 -mmacosx-version-min=10.4"
\$ export LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch x86_64 -arch ppc64 -arch ppc -arch i386 -mmacosx-version-min=10.4"
```

Start the compilation and install