-
Notifications
You must be signed in to change notification settings - Fork 255
Issue #4881 Add Rosetta 2 support for Apple Silicon #5181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
b2d0525
258a75e
cfd240d
71d53e0
b05c0c4
eebd1e6
3a8673d
d05e81d
8267208
b2f8e27
4964fef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -226,6 +226,16 @@ func fixPlistFileExists(agentConfig launchd.AgentConfig) error { | |||||||||||||||||||||||||
| return waitForDaemonRunning() | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| const rosettaPath = "/Library/Apple/usr/libexec/oah/libRosettaRuntime" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| func checkRosettaInstalled() error { | ||||||||||||||||||||||||||
| if _, err := os.Stat(rosettaPath); err != nil { | ||||||||||||||||||||||||||
| return fmt.Errorf("Rosetta is not installed, which is required for x86_64 emulation") | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
Comment on lines
+232
to
+234
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handle non-ENOENT errors separately in Rosetta preflight. Line 232 currently treats every Suggested fix func checkRosettaInstalled() error {
- if _, err := os.Stat(rosettaPath); err != nil {
- return fmt.Errorf("Rosetta is not installed, which is required for x86_64 emulation")
+ if _, err := os.Stat(rosettaPath); err != nil {
+ if os.IsNotExist(err) {
+ return fmt.Errorf("Rosetta is not installed, which is required for x86_64 emulation")
+ }
+ return fmt.Errorf("failed to verify Rosetta installation at %s: %w", rosettaPath, err)
}
return nil
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| return nil | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| func deprecationNotice() error { | ||||||||||||||||||||||||||
| supports, err := darwin.AtLeast("13.0.0") | ||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
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.
Allow explicit
falsefor unsupported platforms.Line 159 currently rejects the setting regardless of value on non-Apple-Silicon hosts. This prevents users from explicitly setting
use-rosetta=false(useful for config portability/reset flows).Suggested fix
func validateRosetta(value interface{}) (bool, string) { - if runtime.GOOS != "darwin" || runtime.GOARCH != "arm64" { - return false, "Rosetta is only supported on Apple Silicon Macs" - } - return ValidateBool(value) + enabled, err := cast.ToBoolE(value) + if err != nil { + return false, "must be true or false" + } + if !enabled { + return true, "" + } + if runtime.GOOS != "darwin" || runtime.GOARCH != "arm64" { + return false, "Rosetta is only supported on Apple Silicon Macs" + } + return true, "" }🤖 Prompt for AI Agents