Skip to content

Instantly share code, notes, and snippets.

@YongmingZhao
Last active April 17, 2022 14:10
Show Gist options
  • Save YongmingZhao/e236d3543a55aa288eedcd3fea7672b4 to your computer and use it in GitHub Desktop.
Save YongmingZhao/e236d3543a55aa288eedcd3fea7672b4 to your computer and use it in GitHub Desktop.
Build Metamask on Mac
  • Prepare a working directory:

    (Optional) nvm is conflict with asdf, if nvm is installed, deactive it

    nvm unload
    rm -rf ~/.nvm # important, further steps will scan this path, remove or rename it

    Create a working directory:

    mkdir metamask
    cd metamask
    asdf local nodejs 14.9.1
    npm install -g npm
    npm install @sentry/cli
    npm install yarn
    asdf local ruby 3.1.2 # do not use system ruby
  • Install the shared React Native dependencies

    • Install watchmen is recommended, but without it just works fine
    • Install Xcode and simulator: Manually download the simulator from direct link, move the dmg file to ~/Library/Caches/com.apple.dt.Xcode/Downloads
    • Rest steps:
      sudo gem install cocoapods
      npx react-native init AwesomeProject # trigger downloading cli
  • Clone the repo and install dependencies:

    git clone ...
    cd metamask-mobile
    cp .ios.env.example .ios.env
    cp .js.env.example .js.env
    ../node_modules/.bin/yarn setup
    cd ios && pod install && cd .. # install pods for iOS

    Solution for unexpected end of JSON input error:

    yarn cache clean --force
    yarn cache clean --all
    yarn setup

    Solution for nvm is not compatible with the "PREFIX" environment variable error:

    Uninstall nvm or try edit metamask-mobile/node_modules/react-native/scripts/find-node.sh, according to this

  • Run app:

    ../node_modules/.bin/yarn watch
    ../node_modules/.bin/yarn start:ios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment