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

chore: made apple native ocr default on apple, remove support for tesseract on apple

Louis Beaumont87b5fb87cd0a
diff --git a/examples/apps/screenpipe-app-tauri/bun.lockb b/examples/apps/screenpipe-app-tauri/bun.lockb
index 4d0e196ba..d4af0b2d6 100755
Binary files a/examples/apps/screenpipe-app-tauri/bun.lockb and b/examples/apps/screenpipe-app-tauri/bun.lockb differ
diff --git a/examples/apps/screenpipe-app-tauri/package.json b/examples/apps/screenpipe-app-tauri/package.json
index 2535718f6..83e6d6536 100644
--- a/examples/apps/screenpipe-app-tauri/package.json
+++ b/examples/apps/screenpipe-app-tauri/package.json
@@ -7,7 +7,7 @@
"lint": "next lint",
"build": "next build",
"tauri": "tauri",
- "clean": "rm -rf out && cargo clean && rm -rf src-tauri/{screenpipe,tesseract,ffmpeg} node_modules"
+ "clean": "rm -rf out && cargo clean && rm -rf src-tauri/{screenpipe-*,tesseract-*,ffmpeg} node_modules"
},
"dependencies": {
"@ai-sdk/openai": "^0.0.39",
diff --git a/examples/apps/screenpipe-app-tauri/scripts/pre_build.js b/examples/apps/screenpipe-app-tauri/scripts/pre_build.js
index fc86ca076..4aa85bca7 100644
--- a/examples/apps/screenpipe-app-tauri/scripts/pre_build.js
+++ b/examples/apps/screenpipe-app-tauri/scripts/pre_build.js
@@ -209,17 +209,10 @@ if (platform == 'macos') {
}
// ! trash code that is going away soon :)
for (const arch of architectures) {
- const tesseractBinary = `./tesseract-${arch}-apple-darwin`;
console.log(`Setting up Tesseract & screenpipe bin for ${arch}...`);
if (arch === 'arm64') {
- // Native architecture or x86_64 on Intel Mac
- if (!(await fs.exists(tesseractBinary))) {
- await $`brew install tesseract`;
- await $`cp $(brew --prefix)/bin/tesseract ${tesseractBinary}`;
- await $`cp /usr/local/bin/tesseract ${tesseractBinary}`;
- }
// copy screenpipe binary (more recent one)
const path1 = "../../../../target/aarch64-apple-darwin/release/screenpipe";
const path2 = "../../../../target/release/screenpipe";
@@ -238,22 +231,29 @@ if (platform == 'macos') {
console.log(`copied release screenpipe binary from ${path2}`);
} else {
console.log("no screenpipe binary found");
+ process.exit(1);
}
- } else if (arch === 'x86_64' && nativeArch === 'arm64') {
- // x86_64 on ARM Mac
- console.log('Installing x86_64 version using Rosetta 2...');
- if (!(await fs.exists(tesseractBinary))) {
- await $`arch -x86_64 /usr/local/bin/brew install tesseract`;
- await $`cp /usr/local/bin/tesseract /tmp/tesseract`
- await $`cp /tmp/tesseract ${tesseractBinary}`;
+ // if the binary exists, hard code the fucking dylib
+ if (await fs.exists('screenpipe-aarch64-apple-darwin')) {
+ await $`install_name_tool -change screenpipe-vision/lib/libscreenpipe_arm64.dylib @rpath/../Frameworks/libscreenpipe_arm64.dylib ./screenpipe-aarch64-apple-darwin`
+ await $`install_name_tool -change screenpipe-vision/lib/libscreenpipe.dylib @rpath/../Frameworks/libscreenpipe.dylib ./screenpipe-aarch64-apple-darwin`
+ console.log(`hard coded the FUCKING dylib`);
}
+ } else if (arch === 'x86_64' && nativeArch === 'arm64') {
+
//check if exists
if (await fs.exists('../../../../target/x86_64-apple-darwin/release/screenpipe')) {
await $`cp ../../../../target/x86_64-apple-darwin/release/screenpipe screenpipe-x86_64-apple-darwin`;
}
+ // hard code the fucking dylib
+ if (await fs.exists('screenpipe-x86_64-apple-darwin')) {
+ await $`install_name_tool -change screenpipe-vision/lib/libscreenpipe_x86_64.dylib @rpath/../Frameworks/libscreenpipe_x86_64.dylib ./screenpipe-x86_64-apple-darwin`
+ await $`install_name_tool -change screenpipe-vision/lib/libscreenpipe.dylib @rpath/../Frameworks/libscreenpipe.dylib ./screenpipe-x86_64-apple-darwin`
+ console.log(`hard coded the FUCKING dylib`);
+ }
}
- console.log(`Tesseract & screenpipe for ${arch} set up successfully.`);
+ console.log(`screenpipe for ${arch} set up successfully.`);
}
diff --git a/examples/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/examples/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index 7a13578a3..18c78658b 100644
--- a/examples/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/examples/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "0.1.39"
+version = "0.1.40"
description = ""
authors = ["you"]
license = ""
diff --git a/examples/apps/screenpipe-app-tauri/src-tauri/tauri.macos.conf.json b/examples/apps/screenpipe-app-tauri/src-tauri/tauri.macos.conf.json
index 4ddcc3479..f91a2e0b4 100644
--- a/examples/apps/screenpipe-app-tauri/src-tauri/tauri.macos.conf.json
+++ b/examples/apps/screenpipe-app-tauri/src-tauri/tauri.macos.conf.json
@@ -23,7 +23,6 @@
"ffmpeg/bin/*": "./"
},
"externalBin": [
- "tesseract",
"screenpipe"
]
}
diff --git a/screenpipe-server/src/bin/screenpipe-server.rs b/screenpipe-server/src/bin/screenpipe-server.rs
index 475a0cb43..619c68921 100644
--- a/screenpipe-server/src/bin/screenpipe-server.rs
+++ b/screenpipe-server/src/bin/screenpipe-server.rs
@@ -31,8 +31,11 @@ use screenpipe_vision::utils::OcrEngine as CoreOcrEngine;
#[derive(Clone, Debug, ValueEnum, PartialEq)]
enum CliOcrEngine {
Unstructured,
+ #[cfg(not(target_os = "macos"))]
Tesseract,
+ #[cfg(target_os = "windows")]
WindowsNative,
+ #[cfg(target_os = "macos")]
AppleNative,
}
@@ -40,13 +43,18 @@ impl From<CliOcrEngine> for CoreOcrEngine {
fn from(cli_engine: CliOcrEngine) -> Self {
match cli_engine {
CliOcrEngine::Unstructured => CoreOcrEngine::Unstructured,
+ #[cfg(not(target_os = "macos"))]
CliOcrEngine::Tesseract => CoreOcrEngine::Tesseract,
+ #[cfg(target_os = "windows")]
CliOcrEngine::WindowsNative => CoreOcrEngine::WindowsNative,
+ #[cfg(target_os = "macos")]
CliOcrEngine::AppleNative => CoreOcrEngine::AppleNative,
}
}
}
+
+
// keep in mind this is the most important feature ever // TODO: add a pipe and a ⭐️ e.g screen | ⭐️ somehow in ascii ♥️🤓
const DISPLAY: &str = r"
_
@@ -71,7 +79,7 @@ struct Cli {
/// 1 FPS = 30 GB / month
/// 5 FPS = 150 GB / month
/// Optimise based on your needs.
- /// You rarely change change more than 1 times within a second, right?
+ /// Your screen rarely change more than 1 times within a second, right?
#[arg(short, long, default_value_t = 1.0)]
fps: f64,
@@ -116,20 +124,30 @@ struct Cli {
#[arg(long, default_value_t = false)]
cloud_audio_on: bool,
- /// OCR engine to use. Tesseract is a local OCR engine (default).
+ /// OCR engine to use.
+ /// AppleNative is the default local OCR engine for macOS.
/// WindowsNative is a local OCR engine for Windows.
/// Unstructured is a cloud OCR engine (free of charge on us)
- #[arg(long, value_enum, default_value_t = CliOcrEngine::Tesseract)]
+ /// Tesseract is a local OCR engine (not supported on macOS)
+ #[cfg_attr(
+ target_os = "macos",
+ arg(long, value_enum, default_value_t = CliOcrEngine::AppleNative)
+ )]
+ #[cfg_attr(
+ not(target_os = "macos"),
+ arg(long, value_enum, default_value_t = CliOcrEngine::Tesseract)
+ )]
ocr_engine: CliOcrEngine,
/// UID key for sending data to friend wearable (if not provided, data won't be sent)
#[arg(long)]
friend_wearable_uid: Option<String>,
+ /// List available monitors, then you can use --monitor-id to select one (with the ID)
#[arg(long)]
list_monitors: bool,
- /// Monitor ID to use
+ /// Monitor ID to use, this will be used to select the monitor to record
#[arg(long)]
monitor_id: Option<u32>,
}
diff --git a/screenpipe-vision/build.rs b/screenpipe-vision/build.rs
index 1b8fc8e8f..e241cb876 100644
--- a/screenpipe-vision/build.rs
+++ b/screenpipe-vision/build.rs
@@ -4,6 +4,7 @@ use std::path::PathBuf;
fn main() {
#[cfg(target_os = "macos")]
{
+
println!("cargo:rustc-link-lib=dylib=screenpipe");
// Get the package root directory
diff --git a/screenpipe-vision/lib/libscreenpipe.dylib b/screenpipe-vision/lib/libscreenpipe.dylib
index b155d542d..641dd60e2 100755
Binary files a/screenpipe-vision/lib/libscreenpipe.dylib and b/screenpipe-vision/lib/libscreenpipe.dylib differ
diff --git a/screenpipe-vision/lib/libscreenpipe_arm64.dylib b/screenpipe-vision/lib/libscreenpipe_arm64.dylib
index 19a421942..df5862a8d 100755
Binary files a/screenpipe-vision/lib/libscreenpipe_arm64.dylib and b/screenpipe-vision/lib/libscreenpipe_arm64.dylib differ
diff --git a/screenpipe-vision/lib/libscreenpipe_x86_64.dylib b/screenpipe-vision/lib/libscreenpipe_x86_64.dylib
index b95f2a625..868a5913c 100755
Binary files a/screenpipe-vision/lib/libscreenpipe_x86_64.dylib and b/screenpipe-vision/lib/libscreenpipe_x86_64.dylib differ