-
Notifications
You must be signed in to change notification settings - Fork 943
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1373 from danmana/feat/warn-apple-silicon-rosetta
- Loading branch information
Showing
4 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
id: rosetta | ||
sidebar_label: Rosetta | ||
title: Apple Silicon under Rosetta | ||
--- | ||
|
||
Running Remotion on Apple Silicon (M1 chip) under Rosetta can be up to 2x slower. | ||
|
||
The recommended way to run Remotion on Apple Silicon is using Node 16 with the native arm64 architecture. | ||
|
||
If you encounter the following warning while using `@remotion/renderer`: | ||
|
||
``` | ||
Apple Silicon detected but running under Rosetta (not arm64 architecture). This will cause performance issues. | ||
Recommended actions: | ||
- Upgrade to Node 16.0.0 or later | ||
- Run Node using `arch -arm64` architecture | ||
``` | ||
|
||
You are either using Node 14 (which uses Rosetta on Apple M1 chips), or you are running a node version installed with `arch -x86_64`. | ||
|
||
## Solution | ||
|
||
1. Upgrade to Node 16 or later | ||
1. Install Node and run it natively | ||
|
||
For example, installing node natively using nvm: | ||
|
||
``` | ||
arch -arm64 zsh | ||
nvm install 16 | ||
``` | ||
|
||
You can check the architecture of your shell by typing in a terminal `arch`. | ||
You can check the Node architecture by running in a terminal `node -p process.arch`. | ||
If both of these print out `arm64` you are good to go. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import * as os from 'os'; | ||
|
||
export const warnIfAppleSiliconIsNotUsingArm64Architecture = () => { | ||
// see https://github.com/nodejs/node/issues/41900#issuecomment-1113511254 | ||
const cpus = os.cpus(); | ||
const isAppleSilicon = cpus[0].model.includes('Apple'); | ||
const isArm64 = os.arch() === 'arm64'; | ||
|
||
if (isAppleSilicon && !isArm64) { | ||
const recommendedNodeVersion = 16; | ||
const version = process.version.replace('v', '').split('.'); | ||
const majorVersion = Number(version[0]); | ||
const recommendNodeUpgrade = majorVersion < recommendedNodeVersion; | ||
|
||
console.warn( | ||
[ | ||
`⚠️ Apple Silicon detected but Node.JS running under Rosetta. This will cause performance issues.\n`, | ||
`Recommended actions:\n`, | ||
recommendNodeUpgrade | ||
? ` - Upgrade to Node ${recommendedNodeVersion} or later\n` | ||
: ' - Run Node using `arch -arm64` architecture\n', | ||
'See https://remotion.dev/docs/troubleshooting/rosetta for more information.', | ||
'---', | ||
] | ||
.filter(Boolean) | ||
.join('\n') | ||
); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8c23211
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
remotion – ./
remotion-remotion.vercel.app
remotion.dev
v3.remotion.dev
remotion.vercel.app
remotion-git-main-remotion.vercel.app
www.remotiondocs.com
www.remotion.dev
remotiondocs.com