Mac 安装 v2rayA 客户端
1. 前置操作
bash
# bin 文件放到 /usr/local/bin 目录下
# 服务 plist 文件放到 ~/Library/LaunchAgents 目录下(一般情况下已经存在)
# 数据放到 /usr/local/share/v2ray 目录下(没有需要创建)
sudo mkdir -p ~/Library/Application Support/v2ray
# 下面的目录会自动创建
# sudo mkdir -p ~/Library/Application Support/v2raya
2. 下载 v2ray
& v2raya
bash
wget https://github.com/v2fly/v2ray-core/releases/download/v5.7.0/v2ray-macos-arm64-v8a.zip
unzip v2ray-macos-arm64-v8a.zip
mv v2ray /usr/local/bin; chmod +x /usr/local/bin/v2ray
mv *dat /usr/local/share/v2ray
# v2rayA
wget https://github.com/v2rayA/v2rayA/releases/download/v2.0.5/v2raya_darwin_arm64_2.0.5
mv v2raya_darwin_arm64_2.0.5 /usr/local/bin/v2raya; chmod /usr/local/bin/v2raya
3. 添加 v2raya.plist
到 ~/Library/LaunchAgents
ini
<!-- ~/Library/LaunchAgents/org.v2raya.v2raya.plist -->
<?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>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/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
4. 启动/停止
launchctl load ~/Library/LaunchAgents/org.v2raya.v2raya.plist
launchctl unload ~/Library/LaunchAgents/org.v2raya.v2raya.plist
5. 访问 http://127.0.0.1:2017
- 创建登录账号
- 配置账号密码等
- 启动服务即可
- 编写规则
- 4.1 透明代理/系统代理 设置为 分流规则与规则端口所选模式一致
- 4.2 规则端口的分流模式 设置为 RoutingA
- 4.3 配置 RoutingA
- 4.4 下面添加需要代理或者直连的规则即可
一般我们需要的都是代理的,简单写包含模式 domain(contains: github) -> proxy domain(contains: cnbeta.com) -> proxy
6. export proxy
bash
export https_proxy=http://127.0.0.1:20171 http_proxy=http://127.0.0.1:20171 all_proxy=socks5://127.0.0.1:20170
7. 这里说一下
可是使用
brew
安装v2rayA
更简单
8. 参考地址
- [RoutingA - GitHub](https://github.com/v2rayA/v2rayA/wiki/RoutingA
- [RoutingA - v2rayA](https://v2raya.org/docs/manual/routinga/
- [Mac 安装 v2rayA](https://v2raya.org/docs/prologue/installation/macos/