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

推荐订阅源

月光博客
月光博客
小众软件
小众软件
爱范儿
爱范儿
Y
Y Combinator Blog
博客园 - Franky
美团技术团队
博客园 - 【当耐特】
The Cloudflare Blog
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
Jina AI
Jina AI
IT之家
IT之家
人人都是产品经理
人人都是产品经理
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
大猫的无限游戏
大猫的无限游戏
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 聂微东
WordPress大学
WordPress大学
V
Visual Studio Blog
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
有赞技术团队
有赞技术团队

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