Skip to content

Commit c23bec6

Browse files
fix: don't set macos deployment target in dev (#14083)
* fix: don't set macos deployment target in dev. * doc comment * Update .changes/skip-deployment-target-in-dev.md * Apply suggestions from code review --------- Co-authored-by: Lucas Fernandes Nogueira <[email protected]>
1 parent 9a35a61 commit c23bec6

File tree

8 files changed

+23
-6
lines changed

8 files changed

+23
-6
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
tauri-build: patch:enhance
3+
tauri-cli: patch:enhance
4+
'@tauri-apps/cli': patch:enhance
5+
---
6+
7+
Tauri now ignores `macOS.minimumSystemVersion` in `tauri dev` to prevent forced rebuilds of macOS specific dependencies when using something like `rust-analyzer` at the same time as `tauri dev`.

crates/tauri-build/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,10 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
573573
}
574574
}
575575

576-
if let Some(version) = &config.bundle.macos.minimum_system_version {
577-
println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET={version}");
576+
if !is_dev() {
577+
if let Some(version) = &config.bundle.macos.minimum_system_version {
578+
println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET={version}");
579+
}
578580
}
579581
}
580582

crates/tauri-cli/config.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3483,7 +3483,7 @@
34833483
]
34843484
},
34853485
"minimumSystemVersion": {
3486-
"description": "A version string indicating the minimum macOS X version that the bundled application supports. Defaults to `10.13`.\n\n Setting it to `null` completely removes the `LSMinimumSystemVersion` field on the bundle's `Info.plist`\n and the `MACOSX_DEPLOYMENT_TARGET` environment variable.\n\n An empty string is considered an invalid value so the default value is used.",
3486+
"description": "A version string indicating the minimum macOS X version that the bundled application supports. Defaults to `10.13`.\n\n Setting it to `null` completely removes the `LSMinimumSystemVersion` field on the bundle's `Info.plist`\n and the `MACOSX_DEPLOYMENT_TARGET` environment variable.\n\n Ignored in `tauri dev`.\n\n An empty string is considered an invalid value so the default value is used.",
34873487
"default": "10.13",
34883488
"type": [
34893489
"string",

crates/tauri-cli/src/build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ pub fn command(mut options: Options, verbosity: u8) -> Result<()> {
104104
let config_guard = config.lock().unwrap();
105105
let config_ = config_guard.as_ref().unwrap();
106106

107+
if let Some(minimum_system_version) = &config_.bundle.macos.minimum_system_version {
108+
std::env::set_var("MACOSX_DEPLOYMENT_TARGET", minimum_system_version);
109+
}
110+
107111
let app_settings = interface.app_settings();
108112
let interface_options = options.clone().into();
109113

crates/tauri-cli/src/bundle.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ pub fn command(options: Options, verbosity: u8) -> crate::Result<()> {
136136
let config_guard = config.lock().unwrap();
137137
let config_ = config_guard.as_ref().unwrap();
138138

139+
if let Some(minimum_system_version) = &config_.bundle.macos.minimum_system_version {
140+
std::env::set_var("MACOSX_DEPLOYMENT_TARGET", minimum_system_version);
141+
}
142+
139143
let app_settings = interface.app_settings();
140144
let interface_options = options.clone().into();
141145

crates/tauri-cli/src/interface/rust.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,6 @@ impl Interface for Rust {
157157
"IPHONEOS_DEPLOYMENT_TARGET",
158158
&config.bundle.ios.minimum_system_version,
159159
);
160-
} else if let Some(minimum_system_version) = &config.bundle.macos.minimum_system_version {
161-
std::env::set_var("MACOSX_DEPLOYMENT_TARGET", minimum_system_version);
162160
}
163161

164162
let app_settings = RustAppSettings::new(config, manifest, target)?;

crates/tauri-schema-generator/schemas/config.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3483,7 +3483,7 @@
34833483
]
34843484
},
34853485
"minimumSystemVersion": {
3486-
"description": "A version string indicating the minimum macOS X version that the bundled application supports. Defaults to `10.13`.\n\n Setting it to `null` completely removes the `LSMinimumSystemVersion` field on the bundle's `Info.plist`\n and the `MACOSX_DEPLOYMENT_TARGET` environment variable.\n\n An empty string is considered an invalid value so the default value is used.",
3486+
"description": "A version string indicating the minimum macOS X version that the bundled application supports. Defaults to `10.13`.\n\n Setting it to `null` completely removes the `LSMinimumSystemVersion` field on the bundle's `Info.plist`\n and the `MACOSX_DEPLOYMENT_TARGET` environment variable.\n\n Ignored in `tauri dev`.\n\n An empty string is considered an invalid value so the default value is used.",
34873487
"default": "10.13",
34883488
"type": [
34893489
"string",

crates/tauri-utils/src/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,8 @@ pub struct MacConfig {
640640
/// Setting it to `null` completely removes the `LSMinimumSystemVersion` field on the bundle's `Info.plist`
641641
/// and the `MACOSX_DEPLOYMENT_TARGET` environment variable.
642642
///
643+
/// Ignored in `tauri dev`.
644+
///
643645
/// An empty string is considered an invalid value so the default value is used.
644646
#[serde(
645647
deserialize_with = "de_macos_minimum_system_version",

0 commit comments

Comments
 (0)