Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: download mlx.metallib from GitHub releases instead of git LFS

Louis Beaumontb5152b51513b
diff --git a/.gitattributes b/.gitattributes
index e07e209ab..2df040972 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -23,4 +23,3 @@ node_modules/* linguist-vendored
*.safetensors filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.tar.gz filter=lfs diff=lfs merge=lfs -text
-apps/screenpipe-app-tauri/src-tauri/mlx.metallib filter=lfs diff=lfs merge=lfs -text
diff --git a/.gitignore b/.gitignore
index eeaf2c473..2788cbb8a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -77,3 +77,4 @@ crates/screenpipe-audio/onnxruntime-win-arm64-1.19.2.zip
crates/screenpipe-audio/openblas-0.3.31-x64.zip
crates/screenpipe-audio/openblas-0.3.31-woa64-dll.zip
apps/screenpipe-app-tauri/src-tauri/openblas/
+apps/screenpipe-app-tauri/src-tauri/mlx.metallib
diff --git a/apps/screenpipe-app-tauri/src-tauri/build.rs b/apps/screenpipe-app-tauri/src-tauri/build.rs
index 75b65f7c9..c0dd06e30 100644
--- a/apps/screenpipe-app-tauri/src-tauri/build.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/build.rs
@@ -363,21 +363,32 @@ fn main() {
// parakeet-mlx crashes with "Failed to load the default metallib".
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
{
- // Verify mlx.metallib exists and is not a placeholder.
- // The real metallib (~84MB) is committed via git LFS and bundled by Tauri
- // into Contents/Resources/. At runtime, main.rs symlinks it to Contents/MacOS/
- // where MLX's colocated library search finds it.
+ // Download mlx.metallib (pre-compiled MLX Metal shaders) for parakeet-mlx.
+ // MLX needs this file next to the binary at runtime. Tauri bundles it into
+ // Contents/Resources/ and main.rs symlinks it to Contents/MacOS/.
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
let metallib = std::path::Path::new(&manifest_dir).join("mlx.metallib");
- if metallib.exists() {
- let size = std::fs::metadata(&metallib).map(|m| m.len()).unwrap_or(0);
- if size > 1_000_000 {
- println!("cargo:warning=mlx-metallib: found ({} MB)", size / 1_000_000);
- } else {
- println!("cargo:warning=mlx-metallib: file too small ({} bytes) — may be placeholder, parakeet-mlx will fail at runtime", size);
+ let min_size = 1_000_000; // real metallib is ~84MB
+
+ let needs_download = !metallib.exists()
+ || std::fs::metadata(&metallib).map(|m| m.len()).unwrap_or(0) < min_size;
+
+ if needs_download {
+ println!("cargo:warning=mlx-metallib: downloading from GitHub releases...");
+ let url = "https://github.com/screenpipe/screenpipe/releases/download/mlx-metallib-v0.2.0/mlx.metallib";
+ let status = std::process::Command::new("curl")
+ .args(["-L", "-f", "-o", metallib.to_str().unwrap(), url])
+ .status();
+ match status {
+ Ok(s) if s.success() => {
+ let size = std::fs::metadata(&metallib).map(|m| m.len()).unwrap_or(0);
+ println!("cargo:warning=mlx-metallib: downloaded ({} MB)", size / 1_000_000);
+ }
+ _ => println!("cargo:warning=mlx-metallib: download failed — parakeet-mlx will crash at runtime"),
}
} else {
- println!("cargo:warning=mlx-metallib: file missing — parakeet-mlx will fail at runtime");
+ let size = std::fs::metadata(&metallib).map(|m| m.len()).unwrap_or(0);
+ println!("cargo:warning=mlx-metallib: already present ({} MB)", size / 1_000_000);
}
}
diff --git a/apps/screenpipe-app-tauri/src-tauri/mlx.metallib b/apps/screenpipe-app-tauri/src-tauri/mlx.metallib
deleted file mode 100644
index 885fdd913..000000000
--- a/apps/screenpipe-app-tauri/src-tauri/mlx.metallib
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:d077110dbe4cf5e2f6572abb7a3e9cfaa87dbfc6d0a1cd647e674735e39ff673
-size 88148749