Created
March 6, 2023 03:25
-
-
Save pich4ya/f4ae0b04f30653b2bcc2f2246bb564af to your computer and use it in GitHub Desktop.
Install proxychains-ng on macOS m1/m2 arm64e natively without Rosetta 2 (2023)
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
# @author Pichaya Morimoto ([email protected]) | |
Problem: | |
```bash | |
brew install proxychains-ng | |
proxychains4 ncat 1.2.3.4 # not working | |
``` | |
There are public workarounds like https://benobi.one/posts/running_brew_on_m1_for_x86/ | |
which suggests to use brew's x86_64 version or run the proxychains4 binary with `arch -x86_64`. | |
This seems to be working, but it hurts performance (with Rosetta 2 emulator). | |
Here we can find the proxychains4 binary, in which, it runs natively on our beloved M1/M2 chips <3 | |
Solution: | |
# M1/M2 supports arm64e, but we need to enable it. | |
# https://developer.apple.com/documentation/driverkit/debugging_and_testing_system_extensions#3626024 | |
# Tested on macOS 13.2.1 (2023) | |
# shutdown & long press Power button to recovery mode -> Terminal | |
csrutil disable | |
# reboot to normal mode | |
# enable arm64e support | |
sudo nvram boot-args=-arm64e_preview_abi | |
# reboot | |
Then, | |
```bash | |
git clone https://github.com/rofl0r/proxychains-ng | |
cd proxychains-ng | |
CFLAGS="-arch arm64e" LDFLAGS="-arch arm64e" ./configure --prefix=/usr/local --bindir=/usr/local/bin --libdir=/usr/local/lib --fat-binary-m1 | |
make | |
$ file ./proxychains4 | |
./proxychains4: Mach-O universal binary with 3 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64:Mach-O 64-bit executable arm64] [arm64e:Mach-O 64-bit executable arm64e] | |
./proxychains4 (for architecture x86_64): Mach-O 64-bit executable x86_64 | |
./proxychains4 (for architecture arm64): Mach-O 64-bit executable arm64 | |
./proxychains4 (for architecture arm64e): Mach-O 64-bit executable arm64e | |
$ ./proxychains4 -f /opt/homebrew/etc/proxychains.conf ncat 127.0.0.1 22 -v | |
[proxychains] config file found: /opt/homebrew/etc/proxychains.conf | |
[proxychains] preloading /xxx/proxychains-ng/libproxychains4.dylib | |
[proxychains] DLL init: proxychains-ng 4.16-git-10-g199d03d | |
Ncat: Version 7.93 ( https://nmap.org/ncat ) | |
[proxychains] Strict chain ... 127.0.0.1:1080 ... 127.0.0.1:22 ... OK | |
Ncat: Connected to 127.0.0.1:22. | |
SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.1 | |
``` | |
can any one compile a m1 version for every one to download that?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Proxychains-ng MacOS M1 -
killed
Issue FixNOTE: All credit to pich4ya for the above solution and crypt0nX's comment. I wrote this to save someone else out there from a trial-by-fire for 2 days trying to find and combine many solutions. I came up with nothing new, and the below guide is just my combination of several solutions.
I will note that the above guide brought me the closest to anything out there, so thank you very much pich4ya.
I was, however, still having the following
killed
issue:No matter how I ran it - with
sudo
, with applications, without applications - nothing worked and it was always beingkilled
.Fix Instructions:
Before performing ANY of pich4ya's above solution, perform the below steps. Pich4ya's steps are integrated into the below solution.
Step 0) Prerequisite - Remove/Uninstall/Delete Previous
proxychains
Files.proxychains
/proxychains-ng
files, especially if installed withbrew
or if you installed manually and ranmake install
.find
command and deleted any file containing theroxychai
substring:Step 1)
Step 2)
arm64e
, as outlined below:Step 3)
CFLAGS
:Step 4) THE FIX
proxychains-ng
, renamed the folder toproxychains-ng-temp
and left it?proxychains4
binary file we just compiled, with the binary we compiled earlier (in theproxychains-ng-temp
folder).IMPORTANT NOTES:
proxychains-ng-test
folder.csrutil
in an earlier step, which provides some critical system security.proxychains
work without issues.csrutil
is only required to run the command in Step 2) d), so we can re-enable it now.proxychains.conf
configuration file every time you runproxychains
.-f
switch.proxychains.conf
file is stored in thesrc
folder of theproxychains-ng
folder downloaded withgit
: