5
0
mirror of https://github.com/cwinfo/yggdrasil-network.github.io.git synced 2024-11-14 15:00:28 +00:00
yggdrasil-network.github.io/platform-macos.md

100 lines
4.1 KiB
Markdown
Raw Normal View History

2018-03-11 22:52:37 +00:00
---
tags: dontlink
2018-07-23 16:39:34 +00:00
sitemap: true
2018-03-11 22:52:37 +00:00
---
# macOS
Yggdrasil is well supported on macOS out of the box, thanks to the inclusion of the `utun` driver in macOS.
## Notes
2018-10-16 15:07:37 +00:00
- Tested and working out of the box on macOS 10.13 High Sierra and 10.14 Mojave.
2018-03-11 22:52:37 +00:00
- May work in theory on any macOS version with `utun` support (which was added in macOS 10.7 Lion), although this is untested at present.
2018-10-16 15:08:29 +00:00
- TAP mode is not supported on macOS, therefore the `IfTAPMode` option will have no effect and will default to TUN mode automatically.
2018-03-11 22:52:37 +00:00
- The maximum MTU size supported on macOS is 65535.
2019-03-02 12:04:32 +00:00
## Installation using the macOS installer (preferred)
2018-12-10 23:22:06 +00:00
2019-03-02 12:01:27 +00:00
Visit the [Builds](builds.md) page and download the relevant `-macos-amd64.pkg` package file.
2018-12-10 23:22:06 +00:00
2019-03-02 12:01:27 +00:00
Once downloaded, open the Downloads folder in Finder, right-click the package and click "Open". (Alternatively, double-click and then use System Preferences > Security to "Open Anyway" after the developer prompt.)
2018-12-10 23:22:06 +00:00
2019-03-02 12:04:32 +00:00
Once installed, configuration will be generated/updated and Yggdrasil will automatically start in the background. You do not need to complete any of the below steps when using this package.
2018-12-10 23:22:06 +00:00
2019-03-02 12:04:32 +00:00
## Manual installation
2018-03-11 22:52:37 +00:00
2018-06-13 22:38:58 +00:00
System Integrity Protection in macOS prevents you from copying files into `/usr/bin`, therefore you should install into `/usr/local/bin` instead. This may not exist by default so create it if it doesn't exist:
2018-03-11 23:00:51 +00:00
```
2018-06-13 22:38:58 +00:00
sudo mkdir -p /usr/local/bin
```
Then [download the latest Yggdrasil binary](https://circleci.com/api/v1.1/project/github/yggdrasil-network/yggdrasil-go/latest/artifacts) and install it:
```
sudo cp ~/Downloads/yggdrasil-x.x.xx-darwin-amd64 /usr/local/bin/yggdrasil
2018-08-03 16:35:12 +00:00
sudo chmod +x /usr/local/bin/yggdrasil
2018-03-11 23:00:51 +00:00
```
Alternatively, compile Yggdrasil from source (below) and install:
2018-03-11 22:52:37 +00:00
```
2018-06-13 22:38:58 +00:00
sudo cp /path/to/yggdrasil-go/yggdrasil /usr/local/bin/yggdrasil
sudo chmod +x /usr/local/bin/yggdrasil
2018-03-11 22:52:37 +00:00
```
2019-03-02 12:04:32 +00:00
### Generate configuration
2018-03-11 22:52:37 +00:00
Before starting Yggdrasil, you should generate configuration:
```
sudo yggdrasil -genconf > /etc/yggdrasil.conf
```
2019-03-02 12:04:32 +00:00
### Run Yggdrasil
2018-03-11 22:52:37 +00:00
2019-03-02 12:04:32 +00:00
#### Run once
2018-03-11 22:52:37 +00:00
Open Terminal.app and start Yggdrasil using your generated configuration:
```
sudo nohup yggdrasil -useconffile /etc/yggdrasil.conf &
```
Alternatively, start Yggdrasil in auto-configuration mode:
```
sudo nohup yggdrasil -autoconf &
```
2019-03-02 12:04:32 +00:00
#### Run as a background service
2018-03-11 22:52:37 +00:00
Running as a background system service means that Yggdrasil will automatically start up in the background when your Mac boots. It also ensures that Yggdrasil will be restarted automatically if the process is terminated for some reason.
2018-03-11 22:52:37 +00:00
2018-10-11 09:19:45 +00:00
You can install Yggdrasil as a launchd service using the launchd scripts in the Git repository. Locate the [`yggdrasil.plist` file in the `contrib` folder](https://raw.githubusercontent.com/yggdrasil-network/yggdrasil-go/master/contrib/macos/yggdrasil.plist) of the repository and make sure that the paths match your installation (i.e. `/usr/local/bin/yggdrasil` and `/etc/yggdrasil.conf`) and then copy it into `/Library/LaunchDaemons/`.
2018-10-11 09:29:16 +00:00
If you already have the source repository to hand, you can instead retrieve `yggdrasil.plist` from there instead of downloading as above:
2018-03-11 22:52:37 +00:00
```
cd /path/to/yggdrasil-go
sudo cp contrib/macos/yggdrasil.plist /Library/LaunchDaemons/
2018-10-11 09:19:45 +00:00
```
Once the `yggdrasil.plist` file is in `/Library/LaunchDaemons/`, you can start the service:
```
2018-03-11 23:05:34 +00:00
sudo launchctl load /Library/LaunchDaemons/yggdrasil.plist
```
When using the launchd scripts from the repository, standard output is logged to `/tmp/yggdrasil.stdout.log` and error output is logged to `/tmp/yggdrasil.stderr.log`.
If you want to stop the Yggdrasil service and prevent it from being restarted by launchd:
```
sudo launchctl unload /Library/LaunchDaemons/yggdrasil.plist
2018-03-11 22:52:37 +00:00
```
## Build instructions
2018-12-09 12:08:59 +00:00
macOS has most of the tools needed to build Yggdrasil from source - you just need to install Go 1.11 or later.
2018-03-11 22:52:37 +00:00
1. Download the latest [Go .pkg installer for macOS](https://golang.org/dl/)
1. Run the installer to install Go on your system
1. Open Terminal.app, clone the repository and build:
```
cd /path/to
git clone https://github.com/yggdrasil-network/yggdrasil-go
cd yggdrasil-go
./build
```
1. The resulting `yggdrasil` file is your build - optionally install it into your system, as above.