Skip to content

Commit 07bbc4e

Browse files
committed
fix: check for Rosetta usage on macOS x64 when using the inspect gpu command
1 parent 6c4e11d commit 07bbc4e

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/cli/commands/OnPostInstallCommand.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ export const OnPostInstallCommand: CommandModule<object, OnPostInstallCommand> =
2121
console.error(
2222
getConsoleLogPrefix(false, false),
2323
chalk.red(
24-
"llama.cpp is not supported on Rosetta on Apple Silicone Macs. " +
25-
"Ensure that you're using a native arm64 node.js installation.")
24+
"llama.cpp is not supported under Rosetta on Apple Silicone Macs. " +
25+
"Ensure that you're using a native arm64 node.js installation."
26+
)
2627
);
2728
console.error(
2829
getConsoleLogPrefix(false, false),

src/cli/commands/inspect/commands/InspectGpuCommand.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {documentationPageUrls} from "../../../../config.js";
1313
import {Llama} from "../../../../bindings/Llama.js";
1414
import {getPlatformInfo} from "../../../../bindings/utils/getPlatformInfo.js";
1515
import {getLinuxDistroInfo} from "../../../../bindings/utils/getLinuxDistroInfo.js";
16+
import {isRunningUnderRosetta} from "../../../utils/isRunningUnderRosetta.js";
1617

1718
type InspectGpuCommand = {
1819
// no options for now
@@ -91,6 +92,17 @@ export const InspectGpuCommand: CommandModule<object, InspectGpuCommand> = {
9192
gpusToLogVramUsageOf.push("metal");
9293
}
9394
} else if (platform === "mac") {
95+
if (await isRunningUnderRosetta()) {
96+
console.error(
97+
chalk.red(
98+
"llama.cpp is not supported under Rosetta on Apple Silicone Macs. " +
99+
"Ensure that you're using a native arm64 node.js installation."
100+
)
101+
);
102+
console.error("process.platform: " + process.platform + ", process.arch: " + process.arch);
103+
console.error("troubleshooting: " + documentationPageUrls.troubleshooting.RosettaIllegalHardwareInstruction);
104+
}
105+
94106
console.info(`${chalk.yellow("Metal:")} ${chalk.red("not supported by llama.cpp on Intel Macs")}`);
95107

96108
const llama = await loadLlamaForGpu(false);

0 commit comments

Comments
 (0)