This template has a general as well as dedicated sections for linux and macOS set up.
I've made a detailed step by step guide on dev.to
covering particular macOS set up steps https://dev.to/adimac93/tauri-mobile-for-ios-4dp6
Tauri mobile is currently in alpha state. Please be aware that breaking changes may happen, thus making the newest version incompatible with previous ones. I'll try to do my best to keep this template up to date.
Install Tauri CLI.
cargo install tauri-cli --version "^2.0.0-alpha"
We also are using pnpm
, so have that installed too, or use npm:
npm install -g pnpm
Clone this repository or use the Github template feature. then, cd
into
the project directory to perform the following steps:
Download project dependencies:
pnpm i
Run tauri dev
to compile dependencies and verify that the app will run locally,
before attempting to run on mobile.
cargo tauri dev
Follow the Tauri mobile guide on setting up linux
Android codegen.
cargo tauri android init
To run the app using an android emulator, run the following (make sure you do not have a physical android phone plugged in):
cargo tauri android dev
Alternatively you can create a release build and copy it to your phone:
cargo tauri android build
this will create an apk file here:
~/src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release-unsigned.apk
this file needs to be signed. you first need to generate a keystore file. Just put in whatever you want during the prompts:
keytool -genkey -v -keystore release-keystore.jks -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
I moved the release-keystore.jks
file to src-tauri/gen/android/
, though not
required. Then you can use that file to sign your app, note that you will need to
point to the apksigner
that you installed with Android Studio in the
prerequsite steps. you will also need to provide the absolute path to the apk
file generated by cargo tauri android build
:
...../Android/Sdk/build-tools/34.0.0/apksigner sign --ks /home/casey/Documents/tauri/tauri-mobile-android/src-tauri/gen/android/release-keystore.jks ...../src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release-unsigned.apk
now plug in your android phone to your computer, allow file transfer, allow the ability to install apps from the file manager, and cut through all the security warnings to install your app!
Newest stable XCode: XCode 14.3.1 download
XCode CLI tools:
$ xcode-select --install
If you have other XCode CLI tools installed, make sure to set the correct version in XCode.
XCode > Settings > Locations > Command Line Tools > [latest stable version]
To enable application signing and testing directly on your mobile device you have to add Apple ID to XCode.
XCode > Settings... > Account > + > Apple ID
If you don't have any mobile device connected you can run this command and choose simulation device.
src-tauri$ cargo tauri ios dev
- iPhone
Settings > Privacy & Security
, scroll down to the Developer Mode list item and navigate into it. Then reboot your phone. - Connect your phone to your MacOS device with cable.
- Open XCode project and open run device selection list
Manage Run Destinations > + > <your phone>
- Run
cargo tauri ios dev
- the application should be copied to your phone. - iPhone `Settings > VPN & Device Management > trust developer
- Run the application
After opening the project in XCode some settings generated by cargo tauri ios init
might be overwritten (especially after accepting recommended project changes).
$ cargo tauri ios open
To fix these issues (PhaseScriptExecution failed
with code 65
) make sure to set up back correct bundle identifier from src-tauri/tauri.conf.json
and the development team (usually position with your Apple ID username).
To find these settings double click on .xcodeproj
file in XCode file explorer and go to Signing & Capabilities
.
If you don't care about your XCode tweaks, you can always remove src-tauri/gen/apple
and rerun cargo tauri ios init
.
If you have any questions, contact me via discord adimac93
.