Status Docs

Build Status Yourself and Participate in a Better Web

0. Prerequisites


On Debian/Ubuntu simply use:

sudo apt install -y git curl make

1. Clone the repository

git clone https://github.com/status-im/status-react
cd status-react

2. Install Dependencies

We use Nix package manager to create custom shells with all the necessary tools with minimal impact to the user’s system. This setup has only been tested following systems:

  • Linux - Ubuntu 20.04, Manjaro, Arch
  • macOS - With XCode 11.1

If it doesn't work for you on another Linux distribution, please install all dependencies manually based on the list below.

Most Makefile targets call a script which will implicitly install all the necessary tools and dependencies. To do this it auto-accepts the Android SDK license agreements.

The pre-defined Nix shells install the following tools:

  • Go, OpenJDK 8, Python 2.7
  • Clojure and shadow-cljs
  • Node.js & Yarn
  • React Native CLI and Watchman
  • Android SDK & NDK
  • Gradle & Maven
  • Fastlane & Cocoapods
  • CMake & extra-cmake-modules
  • Make, Git, cURL, wget, unZip

WARNING: Downloading all of these can take more than an hour depending on your machine and internet speed.

WARNING: On macOS, the build environment is set up to rely on XCode 11.5. To allow an older version edit version in nix/overlay.nix file (xcodeWrapper).

For more information about our Nix setup read our README or watch our Nix presentations.

3. Running development processes

To build Status need to run two processes: Clojure compiler and React Native packager.

Keep both processes running when you develop Status. Restarting them might be requires when updating dependencies or changing Nix configuration.

A. Clojure compiler

In the first terminal window, just run:

make run-clojure

By doing this you will start the compilation of ClojureScript sources. You should wait until it shows you Build completed before running the React Native packager.

You can also start a debugger server using:

make run-re-frisk

For additional information check the following: clj-rn & re-frisk

B. React Native packager

Do this in the second terminal window:

make run-metro

Which starts Metro bundler and watches JavaScript code changes.

4. Build and run the application itself

iOS (macOS only)

make run-ios

If you wish to specify the simulator, just run make run-ios SIMULATOR="iPhone 7".
You can check your available devices by running xcrun simctl list devices from the console.

You can also start XCode and run the application there. Execute open ios/StatusIm.xcworkspace, select a device/simulator and click Run.

Note: Of course, you need to install XCode first in both cases. Just go to Mac AppStore to do this.

Android

make run-android
  • Optional: If you want to use AVD (Android Virtual Device, emulator), please, check this documentation;
  • Optional: If you don’t like AVD, you can also use Genymotion;

Check the following docs if you still have problems:

Advanced Build Options

Running commands in Nix shell

If you want to run any of the commands by hand - like Gradle or Fastlane - you can open a Nix shell using either of:

make shell TARGET=android
make shell TARGET=ios

You can read more about our Nix shells in the docs.

Building and using forks of status-go

If you need to use a branch of a status-go fork as a dependency of status-react, you specify it using an update script:

scripts/update-status-go.sh <rev>

Where rev is a branch name, tag, or commit SHA1 you want to build. The script will save the indicated commit hash along with other information in the status-go-version.json file.

If you are using a GitHub fork of status-go repo, export the STATUS_GO_OWNER environment variable when running the script.

Building local status-go repository

If instead you need to use a locally checked-out status-go repository as a dependency of status-react, you can achieve that by defining the STATUS_GO_SRC_OVERRIDE
environment variable:

export STATUS_GO_SRC_OVERRIDE=$GOPATH/src/github.com/status-im/status-go
# Any command that you run from now on will use the specified status-go location.
make release-android

or for a one-off build:

make release-android STATUS_GO_SRC_OVERRIDE=$GOPATH/src/github.com/status-im/status-go

Troubleshooting

Inspecting app DB inside Clojure REPL

E.g. if you want to check existing accounts in the device, run this function in the REPL:

(get-in @re-frame.db.app-db [:accounts/accounts])

Inspecting current app state in re-frisk web UI

Assuming re-frisk is running in port 4567, you can just navigate to http://localhost:4567/ in a web browser to monitor app state and events.

Updating dependencies

  • make nix-update-pods - iOS CocoaPods dependencies (updates ios/Podfile and ios/Podfile.loc)
  • make nix-update-gradle - Android Gradle/Maven dependencies (updates nix/deps/gradle/deps.json)
  • make nix-update-clojure - Clojure Maven dependencies (updates nix/deps/clojure/deps.json)
  • make nix-update-gems - Fastlane Ruby dependencies (updates fastlane/Gemfile.lock and fastlane/gemset.nix)

I have issues compiling on Xcode 10

Some developers are experiencing errors compiling for iOS on Xcode 10 on macOS Mojave:

error: Build input file cannot be found:

'status-react/node_modules/react-native/third-party/double-conversion-1.1.6/src/cached-powers.cc'

To fix similar errors run the following commands:

{ cd ios && pod update }
{ cd node_modules/react-native/scripts && ./ios-install-third-party.sh }
{ cd node_modules/react-native/third-party/glog-0.3.4/ && ../../scripts/ios-configure-glog.sh }

Now you should be able to compile again. The issue reference is here.

Last update: 2021-09-16