/ docs / run-node / build-source.md
build-source.md
  1  ---
  2  title: Build Nwaku from Source
  3  hide_table_of_contents: true
  4  displayed_sidebar: runNode
  5  ---
  6  
  7  This guide provides detailed steps to build a `nwaku` node from the source code to access the latest development version or a specific commit or release of `nwaku`. For your convenience, you may want to [download a pre-compiled binary](https://github.com/waku-org/nwaku/tags) instead.
  8  
  9  :::info
 10  - A minimum of 2GB of RAM is required to build `nwaku`.
 11  - Nwaku is available for Linux and macOS, with experimental Windows support.
 12  :::
 13  
 14  ## Prerequisites
 15  
 16  To build `nwaku`, you need the standard developer tools, including a C compiler, GNU Make, Bash, Git, Rustup, and PostgreSQL client library.
 17  
 18  ```mdx-code-block
 19  import Tabs from '@theme/Tabs';
 20  import TabItem from '@theme/TabItem';
 21  ```
 22  
 23  <Tabs>
 24  <TabItem value="debian" label="Debian and Ubuntu">
 25  
 26  ```shell
 27  sudo apt-get install build-essential git libpq5 jq
 28  curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
 29  source "$HOME/.cargo/env"
 30  ```
 31  
 32  </TabItem>
 33  <TabItem value="fedora" label="Fedora">
 34  
 35  ```shell
 36  sudo dnf install @development-tools git libpq-devel which
 37  curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
 38  ```
 39  
 40  </TabItem>
 41  <TabItem value="arch" label="Arch Linux">
 42  
 43  ```shell
 44  # Using your favoured AUR helper
 45  sudo [AUR HELPER] -S base-devel git postgresql-libs
 46  curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
 47  ```
 48  
 49  </TabItem>
 50  <TabItem value="mac" label="MacOS (Homebrew)">
 51  
 52  ```shell
 53  brew install cmake git postgresql@15 rustup-init
 54  # Create a symbolic link to libpq.5.dylib in /usr/local/lib/
 55  sudo mkdir -p /usr/local/lib/
 56  sudo ln -s /opt/homebrew/opt/postgresql@15/lib/libpq.5.dylib /usr/local/lib/libpq.dylib
 57  ```
 58  
 59  </TabItem>
 60  </Tabs>
 61  
 62  ## Clone the repository
 63  
 64  Get the source code from the GitHub repository. The default branch is `master`, the release candidate for major updates.
 65  
 66  ```shell
 67  git clone https://github.com/waku-org/nwaku
 68  cd nwaku
 69  ```
 70  
 71  :::tip
 72  You can use `git tag -l` to check specific version tags.
 73  :::
 74  
 75  ## Build the binary
 76  
 77  Build the `nwaku` binary:
 78  
 79  ```shell
 80  make wakunode2
 81  ```
 82  
 83  The first `make` invocation updates to all Git submodules. After each `git pull`, run `make update` to keep the submodules updated in the future.
 84  
 85  ```shell
 86  make update
 87  ```
 88  
 89  ## Run the binary
 90  
 91  Nwaku will create the `wakunode2` binary in the `./build/` directory.
 92  
 93  ```shell
 94  # Run with default configuration
 95  ./build/wakunode2
 96  
 97  # See available command line options
 98  ./build/wakunode2 --help
 99  ```
100  
101  To learn more about running nwaku, have a look at these guides:
102  
103  - [Run a Nwaku Node](/run-node/)
104  - [Run Nwaku in a Docker Container](/run-node/run-docker)
105  - [Run Nwaku with Docker Compose](/run-node/run-docker-compose)
106  - [Node Configuration Methods](/run-node/config-methods)
107  
108  ## Run test suite
109  
110  Run the tests for Waku:
111  
112  ```shell
113  make test
114  ```
115  
116  :::tip Congratulations!
117  You have successfully built the `nwaku` binary from the source code. Have a look at the [Node Configuration Examples](/run-node/configure-nwaku) guide to learn how to configure `nwaku` for different use cases.
118  :::