惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 司徒正美
大猫的无限游戏
大猫的无限游戏
腾讯CDC
J
Java Code Geeks
博客园 - 【当耐特】
Microsoft Azure Blog
Microsoft Azure Blog
V
Visual Studio Blog
人人都是产品经理
人人都是产品经理
博客园 - Franky
博客园 - 聂微东
阮一峰的网络日志
阮一峰的网络日志
美团技术团队
云风的 BLOG
云风的 BLOG
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
雷峰网
雷峰网
B
Blog RSS Feed
博客园_首页
量子位
F
Fortinet All Blogs
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
酷 壳 – CoolShell
酷 壳 – CoolShell
C
Check Point Blog

Yuexun J

Native macOS Updates in Tauri Why MCP Matters Developing an App with My AI Intern My Journey with Vim How the Notion Editor Works The Vim Guide for VS Code Users
How to Make Your Tauri Dev Faster
Yuexun Jiang · 2025-05-01 · via Yuexun J

Tauri is great. Small bundles. Low memory. Not Electron.

But tauri dev can be painfully slow. Change one line of Rust, wait a minute. Watch dependencies recompile for no apparent reason. Wonder if you made a terrible technology choice.

You didn’t. The tooling is just fighting itself.

Here’s how to fix it.

The Problem

Watch your terminal next time you run tauri dev. Notice how it recompiles dependencies that haven’t changed? That’s not normal. Something is triggering unnecessary rebuilds.

The culprit: MACOSX_DEPLOYMENT_TARGET.

Tauri reads bundle.macos.minimumSystemVersion from your config and sets this environment variable during builds. If you haven’t set it, it defaults to 10.13.

Meanwhile, rust-analyzer runs cargo check in your editor — without that variable set. Different environment means different build cache. Every time you save, both tools invalidate each other’s work.

One minute per change. Unacceptable.

The Fix

Make them agree. Add this to your editor settings:

{
  "rust-analyzer.cargo.extraEnv": {
    "MACOSX_DEPLOYMENT_TARGET": "10.13"
  }
}

And this to tauri.conf.json:

{
  "bundle": {
    "macos": {
      "minimumSystemVersion": "10.13"
    }
  }
}

Same value. Both places. Restart everything.

One minute became twenty-five seconds.

Still Slow?

You might still see this: Blocking waiting for file lock on build directory.

rust-analyzer and tauri dev are fighting over the same target folder. One waits for the other. Your build stalls.

Give them separate directories:

{
  "rust-analyzer.cargo.targetDir": "target/analyzer"
}

Now rust-analyzer writes to target/analyzer. tauri dev writes to target. No conflicts.

This also fixes the environment variable problem. Separate caches mean they can’t invalidate each other.

Twenty-five seconds became fifteen.

Going Further

Want more? Tweak your Cargo profiles.

You probably don’t need full debug info for dependencies. A little optimization can speed up linking.

# src-tauri/Cargo.toml

[profile.dev]
incremental = true
opt-level = 0
debug = true

[profile.dev.package."*"]
opt-level = 1
debug = false

First build after this change will be slow. Dependencies need recompiling. Judge by subsequent builds.

Fifteen seconds became ten.

Summary

Three changes:

  1. Match MACOSX_DEPLOYMENT_TARGET — Same value in editor settings and tauri.conf.json. Stops cache invalidation between tools.

  2. Set rust-analyzer.cargo.targetDir — Separate build caches. No file locks. No environment conflicts. This is the big one.

  3. Optimize dependency builds — Less debug info, slight optimization. Minor gains, some trade-offs.

One minute to ten seconds. Worth the five minutes it took to configure.

Now get back to building.

References