This article is converted by 简悦 SimpRead, original link blog.csdn.net
Guide to Installing and Configuring the frp Client (frpc) on macOS Using Homebrew
frp (Fast Reverse Proxy) is a high-performance reverse proxy application commonly used for intranet penetration. This article will introduce how to install frpc on macOS using Homebrew, and how to configure and manage it.
1. Install frpc
Install Using Homebrew (Recommended)
-
Ensure Homebrew is installed
-
Run the following in the terminal:
brew install frpc
After installation, the frpc executable is usually located at:
- M1/M2 series chips:
/opt/homebrew/bin/frpc - Intel-based Mac:
/usr/local/bin/frpc
2. Configure frpc
Create Configuration File
-
Create the configuration directory:
sudo mkdir -p /opt/homebrew/etc/frp -
Create and edit
frpc.toml:sudo nano /opt/homebrew/etc/frp/frpc.toml -
Example configuration:
# Common configuration serverAddr = "Alibaba Cloud server public IP" serverPort = 7000 auth.method = "token" auth.token = "your token" # Gitea service forwarding [[proxies]] name = "Gitea" type = "tcp" localIP = "127.0.0.1" localPort = 3000 # Port of Gitea on Synology remotePort = 3000 # Access port on Alibaba Cloud # GitLab service forwarding [[proxies]] name = "GitLab" type = "tcp" localIP = "127.0.0.1" localPort = 8888 # Port of GitLab on Synology remotePort = 8888 # Access port on Alibaba Cloud
Note: Do not add http:// or https:// before serverAddr
3. Start and Stop frpc
Start frpc
/opt/homebrew/bin/frpc -c /opt/homebrew/etc/frp/frpc.toml
If configured correctly, you will see output similar to:
[I] [service.go:288] login to server success, get run id [xxxxxxx]
Stop frpc
pkill frpc
4. Set frpc to Start at Boot
Use Homebrew Services
-
First, make sure the services tap is installed:
brew tap homebrew/services -
Start the frpc service:
brew services start frpcBy default, it uses
/opt/homebrew/etc/frp/frpc.toml -
Stop the frpc service:
brew services stop frpc
5. View Logs
tail -f /opt/homebrew/var/log/frpc.log
Appendix: Common Configuration Errors
Error example:
parse "http://[http://47.97.xx.xx]:7000": missing ']' in host
Cause: The serverAddr contains the http:// prefix
Solution: Do not add http://, just write the IP or domain name directly