| 1 | # Building Cake Wallet for macOS |
| 2 | |
| 3 | ## Requirements and Setup |
| 4 | |
| 5 | The following are the system requirements to build Cake Wallet for your macOS device. |
| 6 | |
| 7 | ```txt |
| 8 | macOS 15.3.1 |
| 9 | Xcode 16.2 |
| 10 | Flutter 3.27.4 |
| 11 | ``` |
| 12 | |
| 13 | ### 1. Installing dependencies |
| 14 | |
| 15 | For installing dependency tools you can use brew [Install brew](https://brew.sh). |
| 16 | |
| 17 | You may easily install them on your build system with the following command: |
| 18 | |
| 19 | ```zsh |
| 20 | brew install autoconf automake binutils ccache cmake cocoapods go libtool pigz pkg-config |
| 21 | sudo softwareupdate --install-rosetta --agree-to-license |
| 22 | ``` |
| 23 | |
| 24 | ### 2. Installing Xcode |
| 25 | |
| 26 | Download and install the latest version of [Xcode](https://developer.apple.com/xcode/) from macOS App Store. |
| 27 | |
| 28 | Run the following to properly initialize Xcode: |
| 29 | |
| 30 | ```zsh |
| 31 | sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer |
| 32 | sudo xcodebuild -runFirstLaunch |
| 33 | ``` |
| 34 | |
| 35 | ### 3. Installing Flutter |
| 36 | |
| 37 | Install Flutter, specifically version `3.27.4` by following the [official docs](https://docs.flutter.dev/get-started/install/macos/desktop?tab=download). |
| 38 | |
| 39 | NOTE: as `3.27.4` is not the latest version, you'll need to download it from <https://docs.flutter.dev/release/archive> instead of the link in the docs above. |
| 40 | |
| 41 | ### 4. Installing Rust |
| 42 | |
| 43 | Install Rust from the [rustup.rs](https://rustup.rs/) website. |
| 44 | |
| 45 | ```zsh |
| 46 | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh |
| 47 | ``` |
| 48 | |
| 49 | ### 5. Verify Flutter and Xcode installation |
| 50 | |
| 51 | Verify that Flutter and Xcode have been correctly installed on your system with the following command: |
| 52 | |
| 53 | `flutter doctor` |
| 54 | |
| 55 | The output of this command should appear like this, indicating successful installations. If there are problems with your installation of Flutter or Xcode, they **must** be corrected before proceeding. |
| 56 | |
| 57 | ```zsh |
| 58 | Doctor summary (to see all details, run flutter doctor -v): |
| 59 | [✓] Flutter (Channel stable, 3.27.4, on macOS 15.x.x) |
| 60 | ... |
| 61 | [✓] Xcode - develop for iOS and macOS (Xcode 16.2) |
| 62 | ... |
| 63 | ``` |
| 64 | |
| 65 | ### 6. Acquiring the Cake Wallet source code |
| 66 | |
| 67 | Download the latest release tag of Cake Wallet and enter the source code directory: |
| 68 | |
| 69 | ```zsh |
| 70 | git clone https://github.com/cake-tech/cake_wallet.git --branch main |
| 71 | cd cake_wallet/scripts/macos/ |
| 72 | ``` |
| 73 | |
| 74 | NOTE: Replace `main` with the latest release tag available at <https://github.com/cake-tech/cake_wallet/releases/latest>. |
| 75 | |
| 76 | ### 7. Setup and build Cake Wallet from source |
| 77 | |
| 78 | We need to generate project settings like app name, app icon, package name, etc, including what specific variant of the app we want to build. |
| 79 | |
| 80 | To build Cake Wallet from source, run the following: |
| 81 | |
| 82 | ```zsh |
| 83 | source ./app_env.sh cakewallet |
| 84 | ``` |
| 85 | |
| 86 | For Monero.com, instead do: |
| 87 | |
| 88 | ```zsh |
| 89 | source ./app_env.sh monero.com |
| 90 | ``` |
| 91 | |
| 92 | Build the necessary libraries and their dependencies: |
| 93 | |
| 94 | ```zsh |
| 95 | ./build_monero_all.sh |
| 96 | ./build_decred.sh |
| 97 | ``` |
| 98 | |
| 99 | NOTE: This step will take quite a while, so be sure you grab a cup of coffee or a good book! |
| 100 | |
| 101 | Then run the configuration script to setup app name, app icon, etc: |
| 102 | |
| 103 | ```zsh |
| 104 | ./app_config.sh |
| 105 | ``` |
| 106 | |
| 107 | ### 8. Prepare Flutter |
| 108 | |
| 109 | Change back to the root directory of the Cake Wallet source code and install Flutter package dependencies: |
| 110 | |
| 111 | ```zsh |
| 112 | cd ../../ |
| 113 | flutter pub get |
| 114 | ``` |
| 115 | |
| 116 | Generate secrets as placeholders for official API keys etc. along with localization files and mobx models: |
| 117 | |
| 118 | ```zsh |
| 119 | dart run tool/generate_new_secrets.dart |
| 120 | dart run tool/generate_localization.dart |
| 121 | ./model_generator.sh |
| 122 | ``` |
| 123 | |
| 124 | ### 9. Build |
| 125 | |
| 126 | ```zsh |
| 127 | flutter build macos --release |
| 128 | ``` |
| 129 | |
| 130 | Then you can open `macos/Runner.xcworkspace` with Xcode to archive the application. |
| 131 | |
| 132 | If you want to run on a connected device, simply run: |
| 133 | |
| 134 | ```zsh |
| 135 | flutter run |
| 136 | ``` |