1
- //go:build darwin
2
-
3
1
/*
4
2
Copyright © 2018-2025 blacktop
5
3
@@ -26,6 +24,7 @@ package ssh
26
24
import (
27
25
"fmt"
28
26
"path/filepath"
27
+ "runtime"
29
28
"time"
30
29
31
30
"github.com/AlecAivazis/survey/v2"
@@ -100,15 +99,18 @@ var sshDebugserverCmd = &cobra.Command{
100
99
return fmt .Errorf ("failed to copy debugserver to device: %w" , err )
101
100
}
102
101
103
- utils .Indent (log .Info , 2 )("Running 'chmod 0755 /usr/libexec/debugserve ' on device" )
102
+ utils .Indent (log .Info , 2 )("Running 'chmod 0755 /usr/libexec/debugserver ' on device" )
104
103
if err := cli .RunCommand ("chmod 0755 /usr/libexec/debugserver" ); err != nil {
105
104
return fmt .Errorf ("failed to chmod /usr/libexec/debugserver on device: %w" , err )
106
105
}
107
106
} else if cli .FileExists ("/usr/bin/debugserver" ) || viper .GetBool ("ssh.debugserver.force" ) { // OLD location from DDI mount
107
+ if runtime .GOOS != "darwin" {
108
+ return fmt .Errorf ("attempting to extract debugserver from DeveloperDiskImage in XCode.app on non-darwin system (not currently supported)" )
109
+ }
108
110
// Find all the DeveloperDiskImages
109
111
images , err := filepath .Glob ("/Applications/Xcode*.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/*/DeveloperDiskImage.dmg" )
110
112
if err != nil {
111
- return fmt .Errorf ("failed to glob for DeveloperDiskImage.dmg: %w" , err )
113
+ return fmt .Errorf ("failed to glob for DeveloperDiskImage.dmg (in XCode.app) : %w" , err )
112
114
}
113
115
114
116
imagePath := viper .GetString ("ssh.debugserver.image" )
@@ -154,7 +156,7 @@ var sshDebugserverCmd = &cobra.Command{
154
156
if err := cli .CopyToDevice ("/tmp/debugserver" , "/usr/bin/debugserver" ); err != nil {
155
157
return fmt .Errorf ("failed to copy debugserver to device: %w" , err )
156
158
}
157
- utils .Indent (log .Info , 2 )("Running 'chmod 0755 /usr/libexec/debugserve ' on device" )
159
+ utils .Indent (log .Info , 2 )("Running 'chmod 0755 /usr/libexec/debugserver ' on device" )
158
160
if err := cli .RunCommand ("chmod 0755 /usr/bin/debugserver" ); err != nil {
159
161
return fmt .Errorf ("failed to chmod /usr/bin/debugserver on device: %w" , err )
160
162
}
0 commit comments