tauri-apps/tauri · error · tauri_cli::error::Error
iOS folder already exists
Error message
iOS folder already exists
What it means
`tauri plugin ios init` performs the same guard as the Android variant: if an `ios` directory already exists in the output dir it aborts instead of overwriting. Note the check tests for `ios/` even though the framework choice (`--ios-framework spm|xcode`) scaffolds into `ios-spm/` or `ios-xcode/`.
Source
Thrown at crates/tauri-cli/src/plugin/ios.rs:64
/// Type of framework to use for the iOS project.
#[clap(long)]
#[clap(default_value_t = PluginIosFramework::default())]
ios_framework: PluginIosFramework,
}
pub fn command(cli: Cli) -> Result<()> {
match cli.command {
Commands::Init(options) => {
let plugin_name = match options.plugin_name {
None => super::infer_plugin_name(
std::env::current_dir().context("failed to get current directory")?,
)?,
Some(name) => name,
};
let out_dir = PathBuf::from(options.out_dir);
if out_dir.join("ios").exists() {
crate::error::bail!("iOS folder already exists");
}
let handlebars = Handlebars::new();
let mut data = BTreeMap::new();
super::init::plugin_name_data(&mut data, &plugin_name);
let ios_folder_name = match options.ios_framework {
PluginIosFramework::Spm => OsStr::new("ios-spm"),
PluginIosFramework::Xcode => OsStr::new("ios-xcode"),
};
let mut created_dirs = Vec::new();
template::render_with_generator(
&handlebars,
&data,
&super::init::TEMPLATE_DIR,
&out_dir,View on GitHub (pinned to 52e4b6e71d)
Solutions
- Delete or rename the existing `ios/` directory and re-run `tauri plugin ios init`.
- Pick a different `--out-dir` if you want both layouts side by side.
- If migrating from a legacy ios/ folder, port manual Swift changes into the new ios-spm/ios-xcode output after scaffolding.
Example fix
# before tauri plugin ios init # error: iOS folder already exists # after mv ios ios-legacy tauri plugin ios init --ios-framework spm
Defensive patterns
Strategy: validation
Validate before calling
test ! -e ios \ && tauri plugin ios init \ || echo "ios/ already scaffolded - skipping init"
Prevention
- Remember init guards on `ios/` even though output goes to ios-spm/ or ios-xcode/.
- Clean up failed scaffolding attempts before re-running init.
When it happens
Trigger: Running `tauri plugin ios init` in a plugin crate where an `ios/` directory already exists — a previous init with different options, a legacy layout from an older Tauri version, or a stray folder.
Common situations: Switching from the legacy `ios/` layout to `ios-spm`/`ios-xcode` layouts in Tauri 2; re-running init after a failed first attempt; monorepos where out-dir defaults collide.
Related errors
- Android folder already exists
- {} project directory {} doesn't exist. Please run `tauri {}
- No external IP detected.
- failed to read missing addr file {}: {e}
- iOS platform not installed
AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20).
Data as JSON: /api/errors/cf5beb978065c8c6.
Report an issue: GitHub.