Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(mac): LM Studio CLI lookup + start_ollama guard work on macOS

purple5d91ec8cde8c
diff --git a/src-tauri/src/commands/install.rs b/src-tauri/src/commands/install.rs
index e1dc5fbe..abf30b75 100644
--- a/src-tauri/src/commands/install.rs
+++ b/src-tauri/src/commands/install.rs
@@ -1324,8 +1324,18 @@ const LMSTUDIO_INSTALLER_URL: &str =
const LMSTUDIO_DEFAULT_PORT: u16 = 1234;
fn lmstudio_lms_path() -> Option<PathBuf> {
+ // Every branch below is a Windows-ism (`lms.exe`, LOCALAPPDATA/PROGRAMFILES,
+ // the registry, `where`), so on macOS/Linux this returned None even with LM
+ // Studio installed — breaking lmstudio_load/unload/server there. The
+ // cross-platform helper already handles the Unix layout (`lms` with no
+ // extension at ~/.lmstudio/bin, plus Spotlight), so delegate to it.
+ #[cfg(not(target_os = "windows"))]
+ {
+ return crate::os_paths::find_lms_cli();
+ }
// Post-bootstrap: `lms bootstrap` materialises the launcher here and adds
// the same path to PATH. Cheapest check first.
+ #[allow(unreachable_code)]
let direct = dirs::home_dir().map(|h| h.join(".lmstudio").join("bin").join("lms.exe"));
if let Some(ref p) = direct {
if p.exists() {
diff --git a/src-tauri/src/commands/process.rs b/src-tauri/src/commands/process.rs
index 914d5d13..862f19bf 100644
--- a/src-tauri/src/commands/process.rs
+++ b/src-tauri/src/commands/process.rs
@@ -698,18 +698,14 @@ fn is_comfyui_running_on_port(port: u16) -> bool {
#[tauri::command]
pub fn start_ollama(state: State<'_, AppState>) -> Result<serde_json::Value, String> {
- // Check if already running
- {
- let mut cmd = Command::new("tasklist");
- cmd.args(["/FI", "IMAGENAME eq ollama.exe"]);
- #[cfg(target_os = "windows")]
- cmd.creation_flags(CREATE_NO_WINDOW);
- if let Ok(output) = cmd.output() {
- let stdout = String::from_utf8_lossy(&output.stdout);
- if stdout.contains("ollama.exe") {
- println!("[Ollama] Already running");
- return Ok(serde_json::json!({"status": "already_running"}));
- }
+ // Already running? Probe the API port cross-platform. The old check used
+ // Windows-only `tasklist`, which no-op'd on macOS/Linux (same bug fixed in
+ // auto_start_ollama), so this command never reported already_running there.
+ if let Ok(addr) = "127.0.0.1:11434".parse() {
+ if std::net::TcpStream::connect_timeout(&addr, std::time::Duration::from_millis(300)).is_ok()
+ {
+ println!("[Ollama] Already running");
+ return Ok(serde_json::json!({"status": "already_running"}));
}
}