Trang này chưa có bản Tiếng Việt. Đang hiển thị bằng tiếng Anh.
Install Localtonet on macOS
Trong trang này 9 mục
- Before you start
- Install with Homebrew
- Add the Localtonet tap and install
- Check the install
- Install manually
- Download and extract
- Optional: move it into your PATH
- Start the client
- Start it with your token
- Check the session
- Run as a launchd service
- Install the service
- Check that it runs
- What the install creates
- Service commands
- Upgrade
- Uninstall
- Troubleshooting
- Related pages
On macOS the Localtonet client is a console program for Intel and Apple Silicon Macs. Install it with Homebrew or from a ZIP archive, start it with your AuthToken, and install it as a launchd service if it should start on every boot.
Before you start #
- A Localtonet account. Create one for free if you do not have one.
- Your AuthToken. Select Copy on the AuthToken card of the Dashboard, or copy a token from My Tokens.
- For the Homebrew install: Homebrew.
- For the launchd service: an account that can use
sudo.
Install with Homebrew #
-
Add the Localtonet tap and install #
A tap adds a third-party repository to Homebrew, so that you can install and update formulae from it.
Terminalbrew tap localtonet/tap brew install localtonet -
Check the install #
Terminallocaltonet --versionThe command prints the version of the client.
Install manually #
If you prefer a direct download, take the archive for your Mac. The ZIP contains one file, localtonet.
| Mac | Archive |
|---|---|
| Apple Silicon (ARM64) | localtonet-osx-arm64.zip |
| Intel (x64) | localtonet-osx-64.zip |
-
Download and extract #
Apple Siliconcurl -L https://localtonet.com/download/localtonet-osx-arm64.zip -o localtonet-osx-arm64.zip unzip localtonet-osx-arm64.zip -d ~/localtonet chmod 755 ~/localtonet/localtonetIntelcurl -L https://localtonet.com/download/localtonet-osx-64.zip -o localtonet-osx-64.zip unzip localtonet-osx-64.zip -d ~/localtonet chmod 755 ~/localtonet/localtonet -
Optional: move it into your PATH #
Without this step you start the client by its path,
~/localtonet/localtonet. After it you can typelocaltonetin any folder.Terminalsudo mv ~/localtonet/localtonet /usr/local/bin/localtonet
Start the client #
-
Start it with your token #
Terminallocaltonet --authtoken <YOUR_TOKEN>The client stores the token locally. The next time you can start it with
localtonetalone. If you start it without a stored token it asksPlease Enter AuthToken or PIN. -
Check the session #
The terminal shows
Session Status: Connectedabove a table with one row per running tunnel:IP/Url,Protocol,Client IP,Client Port,PingandStatus. The table is empty until you start a tunnel in the dashboard, see Quick start.Press Ctrl + C to stop the client. Press F12 to remove the stored token and exit.
Run as a launchd service #
A service starts Localtonet on every boot, keeps it running after you log out and does not need an open terminal. The service commands need root, so run them with sudo.
-
Install the service #
Terminalsudo localtonet --install-service --authtoken <YOUR_TOKEN>The command registers a system-wide launchd job for this token and starts it right away. It answers with the name of the job:
[CLI] Installed service 'Localtonet_<TOKEN_PREFIX>'<TOKEN_PREFIX>is the first 9 characters of your token. Every token gets its own job, so the other service commands need the same--authtokento find it. -
Check that it runs #
Terminalsudo localtonet --status-service --authtoken <YOUR_TOKEN>A running job answers
[CLI] Service 'Localtonet_<TOKEN_PREFIX>' status: Running. In the dashboard, the token shows Online under My Tokens.
What the install creates #
| Item | Location |
|---|---|
| launchd job definition | /Library/LaunchDaemons/Localtonet_<TOKEN_PREFIX>.plist |
| Standard output of the client | /var/log/Localtonet_<TOKEN_PREFIX>.out.log |
| Error output of the client | /var/log/Localtonet_<TOKEN_PREFIX>.err.log |
The job starts when the Mac boots, and launchd starts the client again when it exits with an error. The job runs the localtonet file from the path it had when you installed the service, with the token as part of its arguments.
Service commands #
Run each command with sudo and add --authtoken <YOUR_TOKEN>.
| Command | What it does |
|---|---|
--install-service | Writes the job definition, loads it and starts the client. |
--start-service | Starts the job. If it is already running, launchd restarts it. |
--stop-service | Stops the client. The job stays installed and starts again on the next boot. |
--status-service | Prints the state, for example Running, Stopped, NotFound or Error. |
--remove-service | Stops the job, unloads it and deletes the job definition. |
The service is installed with the options you pass together with --install-service. The options are listed in the CLI reference.
Upgrade #
- Homebrew:
brew upgrade localtonet - Manual install: download the current archive and replace the
localtonetfile.
If Localtonet runs as a service, install the service again after a Homebrew upgrade: remove it, then install it with the same token. Installing also starts it.
brew upgrade localtonet
sudo localtonet --remove-service --authtoken <YOUR_TOKEN>
sudo localtonet --install-service --authtoken <YOUR_TOKEN>The job keeps the path of the file it was installed from. After a manual upgrade that leaves the client in the same place, it is enough to stop the service with --stop-service, replace the file and start the service with --start-service. Run as a service describes these commands.
Uninstall #
- If you installed the service, remove it:
sudo localtonet --remove-service --authtoken <YOUR_TOKEN> - To remove the stored token, start the client and press F12.
- Remove the client. With Homebrew:
brew uninstall localtonet, andbrew untap localtonet/tapto remove the tap. After a manual install, delete thelocaltonetfile.
Troubleshooting #
Install failed: 'macOS launchd service installation (system level default).' requires elevated (admin/root) privileges.
The command ran without root. Repeat it with sudo.
sudo: localtonet: command not found
sudo does not find the client in its own search path. Give the full path instead. command -v localtonet prints it, for example:
sudo "$(command -v localtonet)" --install-service --authtoken <YOUR_TOKEN>After a manual install without the PATH step, the path is ~/localtonet/localtonet.
Install failed: Plist already exists for 'Localtonet_…'
A service for this token is already installed. Check it with --status-service. To install it again, run --remove-service first.
The service is installed but the token stays Offline
Read the error log of the job, /var/log/Localtonet_<TOKEN_PREFIX>.err.log, and check that the localtonet file still exists at the path it had when you installed the service.
Wrong Token!
The client expects the 33-character AuthToken from My Tokens, or a 6-digit PIN that has not expired. Copy the token again and enter it at the prompt.
This token is used in another localtonet application!
Another Localtonet client on this Mac already runs with the same token. Close it, or start this one with a different token. Use one running client per token.