Skip to content

Commit a39805a

Browse files
committed
Fix Private API causing crashes on macOS Ventura
Fixes BlueBubblesApp#668 Attempt to auto fix m1 w/ ventura private api crash
1 parent 87679b7 commit a39805a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

packages/server/src/server/api/privateApi/PrivateApiService.ts

+19
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Sema } from "async-sema";
44
import { clamp, isEmpty, isNotEmpty } from "@server/helpers/utils";
55
import { TransactionPromise, TransactionResult } from "@server/managers/transactionManager/transactionPromise";
66
import { TransactionManager } from "@server/managers/transactionManager";
7+
import { execSync } from "child_process";
78

89
import { MAX_PORT, MIN_PORT } from "./Constants";
910
import { PrivateApiEventHandler } from "./eventHandlers";
@@ -105,6 +106,9 @@ export class PrivateApiService extends Loggable {
105106
this.log.debug("Starting Private API Helper Services...");
106107
await this.configureServer();
107108

109+
// Execute the boot argument command if conditions are met
110+
this.setBootArgs();
111+
108112
// we need to get the port to open the server on (to allow multiple users to use the bundle)
109113
// we'll base this off the users uid (a unique id for each user, starting from 501)
110114
// we'll subtract 501 to get an id starting at 0, incremented for each user
@@ -408,4 +412,19 @@ export class PrivateApiService extends Loggable {
408412
await this.mode?.stop();
409413
this.log.info(`Private API Helper Stopped...`);
410414
}
415+
416+
private setBootArgs() {
417+
const osVersion = os.release();
418+
const isM1Mac = os.cpus().some(cpu => cpu.model.includes("Apple M1"));
419+
const isVentura = osVersion.startsWith("22.");
420+
421+
if (isM1Mac && isVentura) {
422+
try {
423+
execSync("sudo nvram boot-args=-arm64e_preview_abi");
424+
this.log.info("Successfully set boot-args for macOS Ventura on M1 Mac.");
425+
} catch (error) {
426+
this.log.error("Failed to set boot-args for macOS Ventura on M1 Mac:", error);
427+
}
428+
}
429+
}
411430
}

0 commit comments

Comments
 (0)