tauri-apps/tauri

[bug] Can't run tauri-cli in MacOS

Opened this issue · 3 comments

Describe the bug

$ cargo tauri
dyld[66862]: Library not loaded: @rpath/libbz2.1.dylib
  Referenced from: <3E6145E4-18DE-3872-A4F4-8F2ED3EF6481> /Users/notsee/.cargo/bin/cargo-tauri
  Reason: tried: '/Users/notsee/.rustup/toolchains/stable-aarch64-apple-darwin/lib/libbz2.1.dylib' (no such file), '/Users/notsee/lib/libbz2.1.dylib' (no such file), '/usr/local/lib/libbz2.1.dylib' (no such file), '/usr/lib/libbz2.1.dylib' (no such file, not in dyld cache)
[1]    66862 abort      cargo tauri

and yes, I've followed the prerequisites for MacOS.

I'm running MacOS Sonoma 14.6.1 in MacBook Air M2

Reproduction

No response

Expected behavior

No response

Full tauri info output

$ cargo tauri info
dyld[66886]: Library not loaded: @rpath/libbz2.1.dylib
  Referenced from: <3E6145E4-18DE-3872-A4F4-8F2ED3EF6481> /Users/notsee/.cargo/bin/cargo-tauri
  Reason: tried: '/Users/notsee/.rustup/toolchains/stable-aarch64-apple-darwin/lib/libbz2.1.dylib' (no such file), '/Users/notsee/lib/libbz2.1.dylib' (no such file), '/usr/local/lib/libbz2.1.dylib' (no such file), '/usr/lib/libbz2.1.dylib' (no such file, not in dyld cache)
[1]    66886 abort      cargo tauri info

Stack trace

No response

Additional context

No response

I am experiencing the same problem.

macOS (M1) Sonoma 14.6.1
rustc 1.81.0 (eeb90cda1 2024-09-04)
cargo 1.81.0 (2dbb1af80 2024-08-20)
tauri 1.7.2

However, I ran cargo tauri init

See thewh1teagle/sherpa-rs#25
I had the same issue in different crate on aarch64.
You can patch bzip2 crate and enable static feature.

jbg commented

I found that this happens if the bzip2-sys crate finds a bzip2 library using pkg-config while building, but that library is not in your system dyld path at runtime.

There are multiple ways this could happen but in my case it was because I had a PKG_CONFIG_PATH environment variable set in order to pull in some other libraries for a different project, and the directory pointed to by that variable included a bzip2.pc file. Your case may be different in the details but the core issue (pkg-config finding a library that is not on the dynamic library search path at runtime) will be the same.