macOS
The functionality of v2rayA depends on the V2Ray core, so the kernel needs to be installed.
v2rayA and v2ray do not yet support Packet Filter on macOS / FreeBSD, so transparent proxy cannot be enabled. For security reasons, this wiki will run v2rayA with non-root privileges.
The v2ray core of brew stays at version 4.45, but v2rayA needs the core of version 5.x. Be aware of this change if you choose to install manually.
Install with Homebrew
Please make sure Homebrew is installed and well working.
Installation
Add v2rayA Tap:
brew tap v2raya/v2raya
Install v2rayA:
brew install v2raya/v2raya/v2raya
v2ray5
will be installed as a dependent package of v2rayA, so that v2rayA will run correctly.
Start up
After the installation is complete, you can run v2raya --lite
command in the terminal, or you can start the service:
brew services start v2raya
Manual installation
Create directory
These directories may already exist, please check before creating them.
Binary directory:
sudo mkdir /usr/local/bin/
Data files directory:
sudo mkdir -p /usr/local/share/v2ray/
Service file directory:
mkdir ~/Library/LaunchAgents/
Download v2rayA
Download the binaries for macOS from GitHub Releases
or GitHub Action, then rename to v2raya
and save it to /usr/local/bin/
.
For example:
x86_64:
sudo curl -L https://github.com/v2rayA/v2rayA/releases/download/v1.5.7/v2raya_darwin_x64_1.5.7 -o /usr/local/bin/v2raya
arm64:
sudo curl -L https://github.com/v2rayA/v2rayA/releases/download/v1.5.7/v2raya_darwin_arm64_1.5.7 -o /usr/local/bin/v2raya
Download V2Ray Core / Xray Core
Install V2Ray: https://www.v2fly.org/guide/install.html
Install Xray: https://xtls.github.io/document/install.html
After decompressing the compressed package, move the files in it to the corresponding directory:
sudo mv v2ray /usr/local/bin/
sudo mv *dat /usr/local/share/v2ray/
Permission settings
Give v2rayA and v2ray executable permissions:
sudo chmod 755 /usr/local/bin/v2raya
sudo chmod 755 /usr/local/bin/v2ray
sudo chmod 755 /usr/local/bin/v2ctl
If you encounter security restrictions of macOS, then you need to run the following command:
sudo xattr -d -r com.apple.quarantine /usr/local/bin/*
Create service files
Create a new service file and save it to ~/Library/LaunchAgents/
Example:
nano ~/Library/LaunchAgents/org.v2raya.v2raya.plist
Contents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>V2RAYA_LOG_FILE</key>
<string>/tmp/v2raya.log</string>
<key>V2RAYA_V2RAY_BIN</key>
<string>/usr/local/bin/v2ray</string>
</dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>org.v2raya.v2raya</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/v2raya</string>
<string>--lite</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Start up
launchctl load ~/Library/LaunchAgents/org.v2raya.v2raya.plist
If you want to close the v2rayA service, replace the above command from load
to unload
. The logs can be viewed through the web pages.
Last update on: Apr 13, 2023 19:32 +0800