2019-04-27 15:01:51 +00:00
---
title: Mac OS X
head_inline: "< style > . blue { color : blue ; } < / style > "
---
2019-10-27 08:41:14 +00:00
This guide is based on **macOS Catalina 10.15** .
2019-04-27 15:01:51 +00:00
{: .blue}
### Installing Homebrew
---
```bash
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```
### Getting MongoDB
---
Install MongoDB with Package Manager.
```bash
2019-10-03 07:50:53 +00:00
$ brew tap mongodb/brew
$ brew install mongodb-community
2019-04-27 15:01:51 +00:00
```
Run MongoDB server.
```bash
$ mkdir -p ./data/db
$ mongod --dbpath ./data/db
```
2020-04-11 01:42:43 +00:00
**Tip:** MongoDB is persistent after rebooting with the following commands:
`$ brew services start mongodb-community
{: .notice--info}
2019-04-27 15:01:51 +00:00
### Setting up TUN device (No persistent after rebooting)
---
Install TUN/TAP driver
- You can download it from [http://tuntaposx.sourceforge.net/ ](http://tuntaposx.sourceforge.net/ )
Configure the TUN device.
```bash
$ sudo ifconfig lo0 alias 127.0.0.2 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.3 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.4 netmask 255.255.255.255
$ sudo ifconfig lo0 alias 127.0.0.5 netmask 255.255.255.255
```
Enable IP forwarding & Masquerading
```bash
$ sudo sysctl -w net.inet.ip.forwarding=1
2020-02-17 01:41:16 +00:00
$ sudo sh -c "echo 'nat on {en0} from 10.45.0.0/16 to any -> {en0}' > /etc/pf.anchors/org.open5gs"
2019-10-27 08:41:14 +00:00
$ sudo pfctl -e -f /etc/pf.anchors/org.open5gs
2019-04-27 15:01:51 +00:00
```
2019-10-27 08:41:14 +00:00
**Tip:** The script provided in [$GIT_REPO/misc/netconf.sh ](https://github.com/{{ site.github_username }}/open5gs/blob/master/misc/netconf.sh ) makes it easy to configure the TUN device as follows:
`$ sudo ./misc/netconf.sh`
2019-04-27 15:01:51 +00:00
{: .notice--info}
2019-10-27 08:41:14 +00:00
### Building Open5GS
2019-04-27 15:01:51 +00:00
---
Install the depedencies for building the source code.
```bash
2020-04-11 01:42:43 +00:00
$ brew install mongo-c-driver gnutls libgcrypt libidn libyaml pkg-config
2019-04-27 15:01:51 +00:00
```
2019-10-27 08:41:14 +00:00
Install Meson using Homebrew.
```bash
$ brew install meson
```
Git clone.
2019-04-27 15:01:51 +00:00
```bash
2019-10-27 08:41:14 +00:00
$ git clone https://github.com/{{ site.github_username }}/open5gs
2019-04-27 15:01:51 +00:00
```
2019-10-27 08:41:14 +00:00
To compile with meson:
2019-04-27 15:01:51 +00:00
```bash
2019-10-27 08:41:14 +00:00
$ cd open5gs
2019-12-08 02:46:11 +00:00
$ meson build --prefix=`pwd`/install -D c_std=c99
2019-10-27 08:41:14 +00:00
$ ninja -C build
2019-04-27 15:01:51 +00:00
```
2019-06-01 10:53:57 +00:00
Check whether the compilation is correct.
2019-10-27 08:41:14 +00:00
**Note:** This should require `sudo` due to access `/dev/tun0` .
2019-04-27 15:01:51 +00:00
{: .notice--danger}
2019-06-01 10:53:57 +00:00
```bash
2019-10-27 08:41:14 +00:00
$ sudo ninja -C build test
2019-06-01 10:53:57 +00:00
```
2019-04-27 15:01:51 +00:00
2019-10-27 10:57:18 +00:00
**Tip:** You can also check the result of `sudo ninja -C build test` with a tool that captures packets. If you are running `wireshark` , select the `loopback` interface and set FILTER to `s1ap || gtpv2 || diameter || gtp` . You can see the virtually created packets. [[testsimple.pcapng]]({{ site.url }}{{ site.baseurl }}/assets/pcapng/testsimple.pcapng)
2019-04-27 15:01:51 +00:00
{: .notice--info}
2019-08-25 11:50:01 +00:00
You need to perform **the installation process** .
2019-04-27 15:01:51 +00:00
```bash
2019-10-27 08:41:14 +00:00
$ cd build
$ ninja install
2019-04-27 15:01:51 +00:00
```
2019-10-27 08:41:14 +00:00
### Building WebUI of Open5GS
2019-04-27 15:01:51 +00:00
---
2019-10-27 08:41:14 +00:00
[Node.js ](https://nodejs.org/ ) is required to build WebUI of Open5GS
2019-04-27 15:01:51 +00:00
```bash
$ brew install node
```
Install the dependencies to run WebUI
```bash
2019-10-27 08:41:14 +00:00
$ cd webui
$ npm install
2019-04-27 15:01:51 +00:00
```
The WebUI runs as an [npm ](https://www.npmjs.com/ ) script.
```bash
2019-10-27 08:41:14 +00:00
$ npm run dev
2019-04-27 15:01:51 +00:00
```