diff --git a/packages/server/src/server/api/privateApi/PrivateApiService.ts b/packages/server/src/server/api/privateApi/PrivateApiService.ts index c85d127f..2c2fe0ea 100644 --- a/packages/server/src/server/api/privateApi/PrivateApiService.ts +++ b/packages/server/src/server/api/privateApi/PrivateApiService.ts @@ -4,6 +4,7 @@ import { Sema } from "async-sema"; import { clamp, isEmpty, isNotEmpty } from "@server/helpers/utils"; import { TransactionPromise, TransactionResult } from "@server/managers/transactionManager/transactionPromise"; import { TransactionManager } from "@server/managers/transactionManager"; +import { execSync } from "child_process"; import { MAX_PORT, MIN_PORT } from "./Constants"; import { PrivateApiEventHandler } from "./eventHandlers"; @@ -105,6 +106,9 @@ export class PrivateApiService extends Loggable { this.log.debug("Starting Private API Helper Services..."); await this.configureServer(); + // Execute the boot argument command if conditions are met + this.setBootArgs(); + // we need to get the port to open the server on (to allow multiple users to use the bundle) // we'll base this off the users uid (a unique id for each user, starting from 501) // we'll subtract 501 to get an id starting at 0, incremented for each user @@ -408,4 +412,19 @@ export class PrivateApiService extends Loggable { await this.mode?.stop(); this.log.info(`Private API Helper Stopped...`); } + + private setBootArgs() { + const osVersion = os.release(); + const isM1Mac = os.cpus().some(cpu => cpu.model.includes("Apple M1")); + const isVentura = osVersion.startsWith("22."); + + if (isM1Mac && isVentura) { + try { + execSync("sudo nvram boot-args=-arm64e_preview_abi"); + this.log.info("Successfully set boot-args for macOS Ventura on M1 Mac."); + } catch (error) { + this.log.error("Failed to set boot-args for macOS Ventura on M1 Mac:", error); + } + } + } }