[GH-ISSUE #614] [FEATURE REQUEST] can frpc be built and run on jailbreak iOS devices? #478

Closed
opened 2026-05-05 12:18:38 -06:00 by gitea-mirror · 15 comments
Owner

Originally created by @yi on GitHub (Jan 23, 2018).
Original GitHub issue: https://github.com/fatedier/frp/issues/614

We have a couple of jailbreak iOS devices and realy wish to run frpc on them in order to provide remote shell access over the internet.

I've learned that golang has a subrepository to support iOS. Would it be possible to build frp for iOS commadline? Could you guys please shred some light on this.

thanks.

Originally created by @yi on GitHub (Jan 23, 2018). Original GitHub issue: https://github.com/fatedier/frp/issues/614 We have a couple of jailbreak iOS devices and realy wish to run frpc on them in order to provide remote shell access over the internet. I've learned that golang has a subrepository to support iOS. Would it be possible to build frp for iOS commadline? Could you guys please shred some light on this. thanks.
Author
Owner

@fatedier commented on GitHub (Jan 23, 2018):

I have no plan for that, but you can have a try.

<!-- gh-comment-id:359680749 --> @fatedier commented on GitHub (Jan 23, 2018): I have no plan for that, but you can have a try.
Author
Owner

@yi commented on GitHub (Jan 23, 2018):

好的

<!-- gh-comment-id:359699179 --> @yi commented on GitHub (Jan 23, 2018): 好的
Author
Owner

@frakman1 commented on GitHub (May 4, 2018):

This would be really useful. I've tried to run an ARM/iOS compiled ngrok on an jailbroken phone once and it failed. Please let me know if this works for you @yi
Thanks

<!-- gh-comment-id:386627221 --> @frakman1 commented on GitHub (May 4, 2018): This would be really useful. I've tried to run an ARM/iOS compiled ngrok on an jailbroken phone once and it failed. Please let me know if this works for you @yi Thanks
Author
Owner

@yi commented on GitHub (May 4, 2018):

hi @frakman1

with help from @fatedier , we'd managed to run frpc on iOS. It works quite well on iOS7 actually.

following is the build command.

CC=$GOROOT/misc/ios/clangwrap.sh env CGO_ENABLED=1 GOOS=darwin GOARCH=arm go build -ldflags "-s -w" -o ./frpc_darwin ./cmd/frpc

Run that command on a MacOS, which has XCode installed.

If you encounter errors like: xcrun: error: SDK "iphoneos" cannot be located . Please set XCode path by sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/

<!-- gh-comment-id:386629715 --> @yi commented on GitHub (May 4, 2018): hi @frakman1 with help from @fatedier , we'd managed to run frpc on iOS. It works quite well on iOS7 actually. following is the build command. ``` CC=$GOROOT/misc/ios/clangwrap.sh env CGO_ENABLED=1 GOOS=darwin GOARCH=arm go build -ldflags "-s -w" -o ./frpc_darwin ./cmd/frpc ``` Run that command on a MacOS, which has XCode installed. If you encounter errors like: `xcrun: error: SDK "iphoneos" cannot be located `. Please set XCode path by `sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/ `
Author
Owner

@frakman1 commented on GitHub (May 4, 2018):

Thanks @yi!
I'll try it later when I have my Mac all setup. In the meantime, do you have a copy of the binary I can try?

<!-- gh-comment-id:386635902 --> @frakman1 commented on GitHub (May 4, 2018): Thanks @yi! I'll try it later when I have my Mac all setup. In the meantime, do you have a copy of the binary I can try?
Author
Owner

@caj380 commented on GitHub (May 4, 2018):

Try this: https://drive.google.com/open?id=1N7KWvm3iVwLhsTCqnGc4gs19p0sR8MKS
I went ahead and compiled it for you.

<!-- gh-comment-id:386653732 --> @caj380 commented on GitHub (May 4, 2018): Try this: https://drive.google.com/open?id=1N7KWvm3iVwLhsTCqnGc4gs19p0sR8MKS I went ahead and compiled it for you.
Author
Owner

@frakman1 commented on GitHub (May 4, 2018):

Thanks @caj380 !

I just tried it and keep getting this error:

./frpc_darwin
runtime/cgo: no Info.plist URL
<!-- gh-comment-id:386669605 --> @frakman1 commented on GitHub (May 4, 2018): Thanks @caj380 ! I just tried it and keep getting this error: ``` ./frpc_darwin runtime/cgo: no Info.plist URL ```
Author
Owner

@imKenny-cn commented on GitHub (Jul 27, 2020):

when i run it on ios10.2 ,i get this error:Killed: 9

<!-- gh-comment-id:664094742 --> @imKenny-cn commented on GitHub (Jul 27, 2020): when i run it on ios10.2 ,i get this error:Killed: 9
Author
Owner

@imKenny-cn commented on GitHub (Jul 27, 2020):

hi @frakman1

with help from @fatedier , we'd managed to run frpc on iOS. It works quite well on iOS7 actually.

following is the build command.

CC=$GOROOT/misc/ios/clangwrap.sh env CGO_ENABLED=1 GOOS=darwin GOARCH=arm go build -ldflags "-s -w" -o ./frpc_darwin ./cmd/frpc

Run that command on a MacOS, which has XCode installed.

If you encounter errors like: xcrun: error: SDK "iphoneos" cannot be located . Please set XCode path by sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
when i run it on ios10.2 ,i get this error:Killed: 9

<!-- gh-comment-id:664094830 --> @imKenny-cn commented on GitHub (Jul 27, 2020): > hi @frakman1 > > with help from @fatedier , we'd managed to run frpc on iOS. It works quite well on iOS7 actually. > > following is the build command. > > ``` > CC=$GOROOT/misc/ios/clangwrap.sh env CGO_ENABLED=1 GOOS=darwin GOARCH=arm go build -ldflags "-s -w" -o ./frpc_darwin ./cmd/frpc > ``` > > Run that command on a MacOS, which has XCode installed. > > If you encounter errors like: `xcrun: error: SDK "iphoneos" cannot be located `. Please set XCode path by `sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/ ` when i run it on ios10.2 ,i get this error:Killed: 9
Author
Owner

@frakman1 commented on GitHub (Jul 27, 2020):

Well I decided to try this again.
I compiled it on my Mac using the CC command above (Thanks for that).
It created a Mach-O executable arm_v7 binary
When it finished, I transferred the file frpc_darwin to my iOS device and ran into the dreaded Killed: 9 error.
I then ran this from the iOS terminal:
ldid -S frpc_darwin
chmod a+x frpc_darwin
and got it to work.

# ./frpc_darwin
open ./frpc.ini: no such file or directory

Progress!

Once I added a correctly configured frpc.ini to the filesystem, it now runs correctly on my iOS 10.3.2 jailbroken iPhone.
I've attached the file that works on my iPhone:
frpc_darwin.zip

<!-- gh-comment-id:664102428 --> @frakman1 commented on GitHub (Jul 27, 2020): Well I decided to try this again. I compiled it on my Mac using the `CC` command above (Thanks for that). It created a `Mach-O executable arm_v7` binary When it finished, I transferred the file `frpc_darwin` to my iOS device and ran into the dreaded `Killed: 9` error. I then ran this from the iOS terminal: `ldid -S frpc_darwin` `chmod a+x frpc_darwin` and got it to work. ```bash # ./frpc_darwin open ./frpc.ini: no such file or directory ``` Progress! Once I added a correctly configured `frpc.ini` to the filesystem, it now runs correctly on my iOS 10.3.2 jailbroken iPhone. I've attached the file that works on my iPhone: [frpc_darwin.zip](https://github.com/fatedier/frp/files/5195533/frpc_darwin.zip)
Author
Owner

@sazima commented on GitHub (Sep 24, 2022):

Well I decided to try this again. I compiled it on my Mac using the CC command above (Thanks for that). When it finished, I transferred the file frpc_darwin to my iOS device and ran into the dreaded Killed: 9 error. I then ran this from the iOS terminal: ldid -S frpc_darwin chmod a+x frpc_darwin and got it to work.

# ./frpc_darwin
open ./frpc.ini: no such file or directory

Progress!

Once I added a correctly configured frpc.ini to the filesystem, it now runs correctly on my iOS 10.3.2 jailbroken iPhone. I've attached the file that works on my iPhone: frpc_darwin.zip

Bad CPU type in executable on IOS12.5.5

6p:~/projects root# ./frpc_darwin 
-sh: ./frpc_darwin: Bad CPU type in executable
6p:~/projects root# 


<!-- gh-comment-id:1256976215 --> @sazima commented on GitHub (Sep 24, 2022): > Well I decided to try this again. I compiled it on my Mac using the `CC` command above (Thanks for that). When it finished, I transferred the file `frpc_darwin` to my iOS device and ran into the dreaded `Killed: 9` error. I then ran this from the iOS terminal: `ldid -S frpc_darwin` `chmod a+x frpc_darwin` and got it to work. > > ```shell > # ./frpc_darwin > open ./frpc.ini: no such file or directory > ``` > > Progress! > > Once I added a correctly configured `frpc.ini` to the filesystem, it now runs correctly on my iOS 10.3.2 jailbroken iPhone. I've attached the file that works on my iPhone: [frpc_darwin.zip](https://github.com/fatedier/frp/files/5195533/frpc_darwin.zip) `Bad CPU type in executable` on IOS12.5.5 ``` 6p:~/projects root# ./frpc_darwin -sh: ./frpc_darwin: Bad CPU type in executable 6p:~/projects root# ```
Author
Owner

@frakman1 commented on GitHub (Sep 24, 2022):

Bad CPU type in executable on IOS12.5.5

What iPhone are you on?
You may be on arm64-only and the binary is compiled forarm_v7 architecture.

<!-- gh-comment-id:1256984132 --> @frakman1 commented on GitHub (Sep 24, 2022): > Bad CPU type in executable on IOS12.5.5 What iPhone are you on? You may be on `arm64`-only and the binary is compiled for`arm_v7` architecture.
Author
Owner

@frakman1 commented on GitHub (Sep 24, 2022):

frpc_darwin_arm64.zip

I tried compiling it on a modern Mac (Ventura, M1 silicon) and finally got it to work.
I had to change:
GOOS from darwin -> ios
GOARCH from arm -> arm64

I tested it on the same iPhoneSE and it works

$CC=$GOROOT/misc/ios/clangwrap.sh env CGO_ENABLED=1 GOOS=ios GOARCH=arm64 go build -ldflags "-s -w" -o ./frpc_darwin ./cmd/frpc
$file frpc_darwin
frpc_darwin: Mach-O 64-bit executable arm64

On iPhone:
(I renamed it to frpc_darwin_arm64)

FrakPhoneSE:/frak root# ./frpc_darwin_arm64
Killed: 9
FrakPhoneSE:/frak root# ldid -S f ./frpc_darwin_arm64
./minimal/mapping.h(54): _assert(false); errno=2
FrakPhoneSE:/frak root# chmod a+x ./frpc_darwin_arm64
FrakPhoneSE:/frak root# ./frpc_darwin_arm64
2022/09/24 15:06:53 [I] [service.go:357] [535e47879ad12c32] login to server success, get run id [535e47879ad12c32], server udp port [0]
2022/09/24 15:06:53 [I] [proxy_manager.go:142] [535e47879ad12c32] proxy added: [frak_ssh]
2022/09/24 15:06:53 [I] [control.go:177] [535e47879ad12c32] [frak_ssh] start proxy success
^C

Go environment setup on Mac for reference:

brew install golang
# put this in ~/.bashrc:
export GOPATH="$HOME/go"
export GOROOT="$(brew --prefix golang)/libexec"
export PATH="$PATH:${GOPATH}/bin:${GOROOT}/bin"
$go version
go version go1.19.1 darwin/arm64
<!-- gh-comment-id:1256992596 --> @frakman1 commented on GitHub (Sep 24, 2022): [frpc_darwin_arm64.zip](https://github.com/fatedier/frp/files/9638945/frpc_darwin_arm64.zip) I tried compiling it on a modern Mac (Ventura, M1 silicon) and finally got it to work. I had to change: `GOOS` from `darwin` -> `ios` `GOARCH` from `arm` -> `arm64` I tested it on the same iPhoneSE and it works ``` $CC=$GOROOT/misc/ios/clangwrap.sh env CGO_ENABLED=1 GOOS=ios GOARCH=arm64 go build -ldflags "-s -w" -o ./frpc_darwin ./cmd/frpc ``` ```bash $file frpc_darwin frpc_darwin: Mach-O 64-bit executable arm64 ``` On iPhone: (I renamed it to `frpc_darwin_arm64`) ```bash FrakPhoneSE:/frak root# ./frpc_darwin_arm64 Killed: 9 FrakPhoneSE:/frak root# ldid -S f ./frpc_darwin_arm64 ./minimal/mapping.h(54): _assert(false); errno=2 FrakPhoneSE:/frak root# chmod a+x ./frpc_darwin_arm64 FrakPhoneSE:/frak root# ./frpc_darwin_arm64 2022/09/24 15:06:53 [I] [service.go:357] [535e47879ad12c32] login to server success, get run id [535e47879ad12c32], server udp port [0] 2022/09/24 15:06:53 [I] [proxy_manager.go:142] [535e47879ad12c32] proxy added: [frak_ssh] 2022/09/24 15:06:53 [I] [control.go:177] [535e47879ad12c32] [frak_ssh] start proxy success ^C ``` --- Go environment setup on Mac for reference: ```bash brew install golang # put this in ~/.bashrc: export GOPATH="$HOME/go" export GOROOT="$(brew --prefix golang)/libexec" export PATH="$PATH:${GOPATH}/bin:${GOROOT}/bin" ``` ```bash $go version go version go1.19.1 darwin/arm64 ```
Author
Owner

@davidoffxw commented on GitHub (Dec 31, 2022):

frpc_darwin_arm64.zip

I tried compiling it on a modern Mac (Ventura, M1 silicon) and finally got it to work. I had to change: GOOS from darwin -> ios GOARCH from arm -> arm64

I tested it on the same iPhoneSE and it works

$CC=$GOROOT/misc/ios/clangwrap.sh env CGO_ENABLED=1 GOOS=ios GOARCH=arm64 go build -ldflags "-s -w" -o ./frpc_darwin ./cmd/frpc
$file frpc_darwin
frpc_darwin: Mach-O 64-bit executable arm64

On iPhone: (I renamed it to frpc_darwin_arm64)

FrakPhoneSE:/frak root# ./frpc_darwin_arm64
Killed: 9
FrakPhoneSE:/frak root# ldid -S f ./frpc_darwin_arm64
./minimal/mapping.h(54): _assert(false); errno=2
FrakPhoneSE:/frak root# chmod a+x ./frpc_darwin_arm64
FrakPhoneSE:/frak root# ./frpc_darwin_arm64
2022/09/24 15:06:53 [I] [service.go:357] [535e47879ad12c32] login to server success, get run id [535e47879ad12c32], server udp port [0]
2022/09/24 15:06:53 [I] [proxy_manager.go:142] [535e47879ad12c32] proxy added: [frak_ssh]
2022/09/24 15:06:53 [I] [control.go:177] [535e47879ad12c32] [frak_ssh] start proxy success
^C

Go environment setup on Mac for reference:

brew install golang
# put this in ~/.bashrc:
export GOPATH="$HOME/go"
export GOROOT="$(brew --prefix golang)/libexec"
export PATH="$PATH:${GOPATH}/bin:${GOROOT}/bin"
$go version
go version go1.19.1 darwin/arm64

thanks for your support!
i uesd the file from you,but i got an error:killed 9.
i try to ldid,but the error stills.

<!-- gh-comment-id:1368209325 --> @davidoffxw commented on GitHub (Dec 31, 2022): > [frpc_darwin_arm64.zip](https://github.com/fatedier/frp/files/9638945/frpc_darwin_arm64.zip) > > I tried compiling it on a modern Mac (Ventura, M1 silicon) and finally got it to work. I had to change: `GOOS` from `darwin` -> `ios` `GOARCH` from `arm` -> `arm64` > > I tested it on the same iPhoneSE and it works > > ``` > $CC=$GOROOT/misc/ios/clangwrap.sh env CGO_ENABLED=1 GOOS=ios GOARCH=arm64 go build -ldflags "-s -w" -o ./frpc_darwin ./cmd/frpc > ``` > > ```shell > $file frpc_darwin > frpc_darwin: Mach-O 64-bit executable arm64 > ``` > > On iPhone: (I renamed it to `frpc_darwin_arm64`) > > ```shell > FrakPhoneSE:/frak root# ./frpc_darwin_arm64 > Killed: 9 > FrakPhoneSE:/frak root# ldid -S f ./frpc_darwin_arm64 > ./minimal/mapping.h(54): _assert(false); errno=2 > FrakPhoneSE:/frak root# chmod a+x ./frpc_darwin_arm64 > FrakPhoneSE:/frak root# ./frpc_darwin_arm64 > 2022/09/24 15:06:53 [I] [service.go:357] [535e47879ad12c32] login to server success, get run id [535e47879ad12c32], server udp port [0] > 2022/09/24 15:06:53 [I] [proxy_manager.go:142] [535e47879ad12c32] proxy added: [frak_ssh] > 2022/09/24 15:06:53 [I] [control.go:177] [535e47879ad12c32] [frak_ssh] start proxy success > ^C > ``` > > Go environment setup on Mac for reference: > > ```shell > brew install golang > # put this in ~/.bashrc: > export GOPATH="$HOME/go" > export GOROOT="$(brew --prefix golang)/libexec" > export PATH="$PATH:${GOPATH}/bin:${GOROOT}/bin" > ``` > > ```shell > $go version > go version go1.19.1 darwin/arm64 > ``` thanks for your support! i uesd the file from you,but i got an error:killed 9. i try to ldid,but the error stills.
Author
Owner

@davidoffxw commented on GitHub (Dec 31, 2022):

frpc_darwin_arm64.zip

I tried compiling it on a modern Mac (Ventura, M1 silicon) and finally got it to work. I had to change: GOOS from darwin -> ios GOARCH from arm -> arm64

I tested it on the same iPhoneSE and it works

$CC=$GOROOT/misc/ios/clangwrap.sh env CGO_ENABLED=1 GOOS=ios GOARCH=arm64 go build -ldflags "-s -w" -o ./frpc_darwin ./cmd/frpc
$file frpc_darwin
frpc_darwin: Mach-O 64-bit executable arm64

On iPhone: (I renamed it to frpc_darwin_arm64)

FrakPhoneSE:/frak root# ./frpc_darwin_arm64
Killed: 9
FrakPhoneSE:/frak root# ldid -S f ./frpc_darwin_arm64
./minimal/mapping.h(54): _assert(false); errno=2
FrakPhoneSE:/frak root# chmod a+x ./frpc_darwin_arm64
FrakPhoneSE:/frak root# ./frpc_darwin_arm64
2022/09/24 15:06:53 [I] [service.go:357] [535e47879ad12c32] login to server success, get run id [535e47879ad12c32], server udp port [0]
2022/09/24 15:06:53 [I] [proxy_manager.go:142] [535e47879ad12c32] proxy added: [frak_ssh]
2022/09/24 15:06:53 [I] [control.go:177] [535e47879ad12c32] [frak_ssh] start proxy success
^C

Go environment setup on Mac for reference:

brew install golang
# put this in ~/.bashrc:
export GOPATH="$HOME/go"
export GOROOT="$(brew --prefix golang)/libexec"
export PATH="$PATH:${GOPATH}/bin:${GOROOT}/bin"
$go version
go version go1.19.1 darwin/arm64

i used iphone 6s ios13.5

<!-- gh-comment-id:1368209415 --> @davidoffxw commented on GitHub (Dec 31, 2022): > [frpc_darwin_arm64.zip](https://github.com/fatedier/frp/files/9638945/frpc_darwin_arm64.zip) > > I tried compiling it on a modern Mac (Ventura, M1 silicon) and finally got it to work. I had to change: `GOOS` from `darwin` -> `ios` `GOARCH` from `arm` -> `arm64` > > I tested it on the same iPhoneSE and it works > > ``` > $CC=$GOROOT/misc/ios/clangwrap.sh env CGO_ENABLED=1 GOOS=ios GOARCH=arm64 go build -ldflags "-s -w" -o ./frpc_darwin ./cmd/frpc > ``` > > ```shell > $file frpc_darwin > frpc_darwin: Mach-O 64-bit executable arm64 > ``` > > On iPhone: (I renamed it to `frpc_darwin_arm64`) > > ```shell > FrakPhoneSE:/frak root# ./frpc_darwin_arm64 > Killed: 9 > FrakPhoneSE:/frak root# ldid -S f ./frpc_darwin_arm64 > ./minimal/mapping.h(54): _assert(false); errno=2 > FrakPhoneSE:/frak root# chmod a+x ./frpc_darwin_arm64 > FrakPhoneSE:/frak root# ./frpc_darwin_arm64 > 2022/09/24 15:06:53 [I] [service.go:357] [535e47879ad12c32] login to server success, get run id [535e47879ad12c32], server udp port [0] > 2022/09/24 15:06:53 [I] [proxy_manager.go:142] [535e47879ad12c32] proxy added: [frak_ssh] > 2022/09/24 15:06:53 [I] [control.go:177] [535e47879ad12c32] [frak_ssh] start proxy success > ^C > ``` > > Go environment setup on Mac for reference: > > ```shell > brew install golang > # put this in ~/.bashrc: > export GOPATH="$HOME/go" > export GOROOT="$(brew --prefix golang)/libexec" > export PATH="$PATH:${GOPATH}/bin:${GOROOT}/bin" > ``` > > ```shell > $go version > go version go1.19.1 darwin/arm64 > ``` i used iphone 6s ios13.5
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#478
No description provided.