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