:::info
This guide is referring to the [PJSIP Documentation](https://docs.pjsip.org/en/latest/get-started/posix/build_instructions.html#using-default-settings).
:::
[TOC]
## Install GNU Tools
- Tools needed: GNU make (other make will not work), GNU binutils, GNU gcc.
```shell=
brew install make
brew install binutils
brew install gcc
```
> Here I use [Homebrew](https://brew.sh/) to install the packages. However, there are other options available such as [MacPorts](https://www.macports.org/).
- (Optional) If you need to have binutils first in your PATH, run:
```shell=
echo 'export PATH="/opt/homebrew/opt/binutils/bin:$PATH"' >> ~/.zshrc
```
- For compilers to find binutils you may need to set:
```shell=
export LDFLAGS="-L/opt/homebrew/opt/binutils/lib"
export CPPFLAGS="-I/opt/homebrew/opt/binutils/include"
```
:::info
Note: `gmake` is specified instead of `make` in MacOS to invoke **GNU make** instead of the native make.
:::
## Install PJSIP
- Clone the source code from [GitHub - pjsip/pjproject](https://github.com/pjsip/pjproject)
```shell=
git clone https://github.com/pjsip/pjproject.git
```
- It is recommended to start with default settings in `pjlib/include/pj/config_site_sample.h`, by including this file in `config_site.h`(you should create yourself).
```shell=
cd pjproject
vi pjlib/include/pj/config_site.h
```
, then add:
```c=
#include <pj/config_site_sample.h>
```
- Run `./configure`
```shell=
./configure
```
> This will let the script detect the appropriate settings for the host.
> The default settings build the libraries in release mode.
- Run GNU make
```shell=
gmake dep
gmake
```
- After compiling successfully, you will find an executable file `pjsua-arm-apple-darwin21.6.0` under `pjsip-apps/bin/`.
- Execute the file to start an UA
```shell=
./pjsua-arm-apple-darwin21.6.0 --no-tcp
./pjsua-arm-apple-darwin21.6.0 --no-tcp sip:<ip_addr>
```