Using Mac
How to set up a local development environment for Celo using Mac.
While many commands will be the same, you may need to follow the instructions for your specific OS when installing software. The Celo docs have some resources for Windows development.
Before building on Celo, you need to set up a development environment to make sure you have the proper tools to build an application. This setup includes a combination of general development tools, Celo specific tools, and mobile development tools.
Web2 Prerequisites
Xcode
Xcode is Apple's integrated development environment for macOS, used to develop software for macOS, iOS, iPadOS, watchOS, and tvOS.
While Xcode falls under the Celo Prerequisites, Xcode takes a long time to download, which is why it is first on this list. It's best to start this download first, or even start downloading it before going to bed (depending on your internet connection).
Node, NPM and NVM
Node
Node is a JavaScript runtime that allows you to execute JS code outside a web browser. It is an open-source server environment and runs on various platforms.
NPM
npm
stands for Node Package Manager and is the world's largest software registry. npm is what you'll use for installing published JS packages. npm comes bundled with Node, so you won't need to install it separately.
NVM
nvm
stands for Node Version Manager. Different projects often require different versions of Node, and nvm makes it easy to switch between those versions. This is recommended if you plan to develop a lot of JS-based applications and npm also recommends nvm. For Windows users, there are nodist and nvm-windows.
Install Node and npm via nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
Verify the installation by running:
command -v nvm
which should output nvm.
You can now install Node with nvm install <version>
.
You can switch node versions using
nvm use <version>
Homebrew
Homebrew is a way of managing packages on macOS.
Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Get the latest packages
brew update
Yarn
yarn
is a package manager similar to npm
. For the most part, they do the same job and projects will let you know in the README
or package.json
which package manager they recommend using. Usually, you can use either or, but you should not use both in the same project. Running the Celo Development Blockchain requires yarn
, so you can install it now.
Install yarn
Option 1: Since you already have npm
installed, you can use it to install yarn
npm install -g yarn
This will install the Yarn global binary.
The -g
is short for --global
. This flag means you are installing this package on your system and it will be accessible from the cli no matter what project you are in.
Option 2: Install yarn
with Homebrew
# Update brew if you haven't recently
$ brew update
# Install yarn
$ brew install yarn
Expo
Expo is a framework and a platform for universal React applications. It lets you build mobile applications for both iOS and Android while using the same JavaScript/TypeScript codebase. This means that you don't need to be a "mobile developer" to build mobile apps!