Skip to content

Commit

Permalink
Merge pull request #94 from AkihiroSuda/dev
Browse files Browse the repository at this point in the history
README.md: updates about the installation method
  • Loading branch information
AkihiroSuda authored Dec 4, 2024
2 parents 2349471 + b4c1bdf commit b02a310
Showing 1 changed file with 91 additions and 58 deletions.
149 changes: 91 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ Unlike `vde_vmnet`, `socket_vmnet` does not depend on VDE.
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [Install](#install)
- [From binary](#from-binary)
- [From source](#from-source)
- [From Homebrew](#from-homebrew)
- [From MacPorts](#from-macports)
- [From source](#from-source)
- [Usage](#usage)
- [QEMU](#qemu)
- [Lima](#lima)
Expand All @@ -39,30 +40,51 @@ Unlike `vde_vmnet`, `socket_vmnet` does not depend on VDE.

Requires macOS 10.15 or later.

### From Homebrew
### From binary

```bash
brew install socket_vmnet
VERSION="$(curl -fsSL https://api.github.com/repos/lima-vm/socket_vmnet/releases/latest | jq -r .tag_name)"
FILE="socket_vmnet-${VERSION:1}-$(uname -m).tar.gz"

# Download the binary archive
curl -OSL "https://github.com/lima-vm/socket_vmnet/releases/download/${VERSION}/${FILE}"

# (Optional) Attest the GitHub Artifact Attestation using GitHub's gh command (https://cli.github.com)
gh attestation verify --owner=lima-vm "${FILE}"

# (Optional) Preview the contents of the binary archive
tar tzvf "${FILE}"

# Install /opt/socket_vmnet from the binary archive
sudo tar Cxzvf / "${FILE}" opt/socket_vmnet
```

The binaries will be installed onto the following paths:
This downloads and installs the latest release from <https://github.com/lima-vm/socket_vmnet/releases>.

- `${HOMEBREW_PREFIX}/opt/socket_vmnet/bin/socket_vmnet`
- `${HOMEBREW_PREFIX}/opt/socket_vmnet/bin/socket_vmnet_client`
### From source
```bash
sudo make install.bin
```

The `${HOMEBREW_PREFIX}` path defaults to `/opt/homebrew` on ARM, `/usr/local` on Intel.
This installs binaries using `PREFIX=/opt/socket_vmnet`:

The `${HOMEBREW_PREFIX}/opt/socket_vmnet` directory is usually symlinked to `../Cellar/socket_vmnet/${VERSION}`.
- `/opt/socket_vmnet/bin/socket_vmnet`
- `/opt/socket_vmnet/bin/socket_vmnet_client`

You can customize the install location using the `PREFIX` environment variable,
however, it is highly recommended to set the prefix to a directory that can be
only written by the root. Note that `/usr/local/bin` is sometimes chowned for a
non-admin user, so `/usr/local` is _not_ an appropriate prefix.

Run the following command to start the daemon:

```bash
mkdir -p ${HOMEBREW_PREFIX}/var/run
sudo ${HOMEBREW_PREFIX}/opt/socket_vmnet/bin/socket_vmnet --vmnet-gateway=192.168.105.1 ${HOMEBREW_PREFIX}/var/run/socket_vmnet
sudo /opt/socket_vmnet/bin/socket_vmnet --vmnet-gateway=192.168.105.1 /var/run/socket_vmnet
```

> [!WARNING]
> Typically, the `socket_vmnet` binary in the `${HOMEBREW_PREFIX}` can be replaced by any user in the `admin` group.
> [!TIP]
> `sudo make install` is also available in addition to `sudo make install.bin`.
> The former one installs the launchd service (see below) too.
<details>

Expand All @@ -73,48 +95,59 @@ sudo ${HOMEBREW_PREFIX}/opt/socket_vmnet/bin/socket_vmnet --vmnet-gateway=192.16
To install the launchd service:

```bash
# sudo is necessary for the next line
sudo ${HOMEBREW_PREFIX}/bin/brew services start socket_vmnet
sudo make install.launchd
```

The launchd unit file will be installed as `/Library/LaunchDaemons/homebrew.mxcl.socket_vmnet.plist`.
The launchd unit file will be installed as `/Library/LaunchDaemons/io.github.lima-vm.socket_vmnet.plist`.

Default configuration:

| Config | Value |
| ------- | ------------------------------------------------ |
| Socket | `${HOMEBREW_PREFIX}/var/run/socket_vmnet` |
| Stdout | `${HOMEBREW_PREFIX}/var/log/socket_vmnet/stdout` |
| Stderr | `${HOMEBREW_PREFIX}/var/log/socket_vmnet/stderr` |
| Gateway | 192.168.105.1 |
| Config | Value |
| ------- | ------------------------------ |
| Socket | `/var/run/socket_vmnet` |
| Stdout | `/var/log/socket_vmnet/stdout` |
| Stderr | `/var/log/socket_vmnet/stderr` |
| Gateway | 192.168.105.1 |

To uninstall the launchd service:

```bash
sudo ${HOMEBREW_PREFIX}/bin/brew services stop socket_vmnet
sudo make uninstall.launchd
```

</p>

</details>

### From MacPorts
### From Homebrew

<details>

<p>

```bash
sudo port install socket_vmnet
brew install socket_vmnet
```

The binaries will be installed onto the following paths:

- `/opt/local/bin/socket_vmnet`
- `/opt/local/bin/socket_vmnet_client`
- `${HOMEBREW_PREFIX}/opt/socket_vmnet/bin/socket_vmnet`
- `${HOMEBREW_PREFIX}/opt/socket_vmnet/bin/socket_vmnet_client`

Run the following command to start the daemon manually:
The `${HOMEBREW_PREFIX}` path defaults to `/opt/homebrew` on ARM, `/usr/local` on Intel.

The `${HOMEBREW_PREFIX}/opt/socket_vmnet` directory is usually symlinked to `../Cellar/socket_vmnet/${VERSION}`.

Run the following command to start the daemon:

```bash
sudo /opt/local/bin/socket_vmnet --vmnet-gateway=192.168.105.1 /var/run/socket_vmnet
mkdir -p ${HOMEBREW_PREFIX}/var/run
sudo ${HOMEBREW_PREFIX}/opt/socket_vmnet/bin/socket_vmnet --vmnet-gateway=192.168.105.1 ${HOMEBREW_PREFIX}/var/run/socket_vmnet
```

> [!WARNING]
> Typically, the `socket_vmnet` binary in the `${HOMEBREW_PREFIX}` can be replaced by any user in the `admin` group.
<details>

<summary>Launchd (optional, not needed for Lima)</summary>
Expand All @@ -124,54 +157,54 @@ sudo /opt/local/bin/socket_vmnet --vmnet-gateway=192.168.105.1 /var/run/socket_
To install the launchd service:

```bash
sudo port load socket_vmnet
# sudo is necessary for the next line
sudo ${HOMEBREW_PREFIX}/bin/brew services start socket_vmnet
```

The launchd unit file will be installed as
`/Library/LaunchDaemons/org.macports.socket_vmnet.plist`.
The launchd unit file will be installed as `/Library/LaunchDaemons/homebrew.mxcl.socket_vmnet.plist`.

Default configuration:

| Config | Value |
| ------- | --------------------------- |
| Socket | `/var/run/socket_vmnet` |
| Stdout | `/var/log/socket_vmnet.log` |
| Gateway | 192.168.105.1 |
| Config | Value |
| ------- | ------------------------------------------------ |
| Socket | `${HOMEBREW_PREFIX}/var/run/socket_vmnet` |
| Stdout | `${HOMEBREW_PREFIX}/var/log/socket_vmnet/stdout` |
| Stderr | `${HOMEBREW_PREFIX}/var/log/socket_vmnet/stderr` |
| Gateway | 192.168.105.1 |

To uninstall the launchd service:

```bash
sudo port unload socket_vmnet
sudo ${HOMEBREW_PREFIX}/bin/brew services stop socket_vmnet
```

</p>

</details>

### From source
</p>

</details>

### From MacPorts

<details>

<p>

```bash
sudo make install.bin
sudo port install socket_vmnet
```

This installs binaries using `PREFIX=/opt/socket_vmnet`:

- `/opt/socket_vmnet/bin/socket_vmnet`
- `/opt/socket_vmnet/bin/socket_vmnet_client`
The binaries will be installed onto the following paths:

You can customize the install location using the `PREFIX` environment variable,
however, it is highly recommended to set the prefix to a directory that can be
only written by the root. Note that `/usr/local/bin` is sometimes chowned for a
non-admin user, so `/usr/local` is _not_ an appropriate prefix.
- `/opt/local/bin/socket_vmnet`
- `/opt/local/bin/socket_vmnet_client`

Run the following command to start the daemon:
Run the following command to start the daemon manually:

```bash
sudo /opt/socket_vmnet/bin/socket_vmnet --vmnet-gateway=192.168.105.1 /var/run/socket_vmnet
sudo /opt/local/bin/socket_vmnet --vmnet-gateway=192.168.105.1 /var/run/socket_vmnet
```

<details>
Expand All @@ -183,24 +216,24 @@ sudo /opt/socket_vmnet/bin/socket_vmnet --vmnet-gateway=192.168.105.1 /var/run/s
To install the launchd service:

```bash
sudo make install.launchd
sudo port load socket_vmnet
```

The launchd unit file will be installed as `/Library/LaunchDaemons/io.github.lima-vm.socket_vmnet.plist`.
The launchd unit file will be installed as
`/Library/LaunchDaemons/org.macports.socket_vmnet.plist`.

Default configuration:

| Config | Value |
| ------- | ------------------------------ |
| Socket | `/var/run/socket_vmnet` |
| Stdout | `/var/log/socket_vmnet/stdout` |
| Stderr | `/var/log/socket_vmnet/stderr` |
| Gateway | 192.168.105.1 |
| Config | Value |
| ------- | --------------------------- |
| Socket | `/var/run/socket_vmnet` |
| Stdout | `/var/log/socket_vmnet.log` |
| Gateway | 192.168.105.1 |

To uninstall the launchd service:

```bash
sudo make uninstall.launchd
sudo port unload socket_vmnet
```

</p>
Expand Down

0 comments on commit b02a310

Please sign in to comment.