Skip to content

Commit b02a310

Browse files
authored
Merge pull request #94 from AkihiroSuda/dev
README.md: updates about the installation method
2 parents 2349471 + b4c1bdf commit b02a310

File tree

1 file changed

+91
-58
lines changed

1 file changed

+91
-58
lines changed

README.md

Lines changed: 91 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ Unlike `vde_vmnet`, `socket_vmnet` does not depend on VDE.
1313
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
1414

1515
- [Install](#install)
16+
- [From binary](#from-binary)
17+
- [From source](#from-source)
1618
- [From Homebrew](#from-homebrew)
1719
- [From MacPorts](#from-macports)
18-
- [From source](#from-source)
1920
- [Usage](#usage)
2021
- [QEMU](#qemu)
2122
- [Lima](#lima)
@@ -39,30 +40,51 @@ Unlike `vde_vmnet`, `socket_vmnet` does not depend on VDE.
3940

4041
Requires macOS 10.15 or later.
4142

42-
### From Homebrew
43+
### From binary
4344

4445
```bash
45-
brew install socket_vmnet
46+
VERSION="$(curl -fsSL https://api.github.com/repos/lima-vm/socket_vmnet/releases/latest | jq -r .tag_name)"
47+
FILE="socket_vmnet-${VERSION:1}-$(uname -m).tar.gz"
48+
49+
# Download the binary archive
50+
curl -OSL "https://github.com/lima-vm/socket_vmnet/releases/download/${VERSION}/${FILE}"
51+
52+
# (Optional) Attest the GitHub Artifact Attestation using GitHub's gh command (https://cli.github.com)
53+
gh attestation verify --owner=lima-vm "${FILE}"
54+
55+
# (Optional) Preview the contents of the binary archive
56+
tar tzvf "${FILE}"
57+
58+
# Install /opt/socket_vmnet from the binary archive
59+
sudo tar Cxzvf / "${FILE}" opt/socket_vmnet
4660
```
4761

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

50-
- `${HOMEBREW_PREFIX}/opt/socket_vmnet/bin/socket_vmnet`
51-
- `${HOMEBREW_PREFIX}/opt/socket_vmnet/bin/socket_vmnet_client`
64+
### From source
65+
```bash
66+
sudo make install.bin
67+
```
5268

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

55-
The `${HOMEBREW_PREFIX}/opt/socket_vmnet` directory is usually symlinked to `../Cellar/socket_vmnet/${VERSION}`.
71+
- `/opt/socket_vmnet/bin/socket_vmnet`
72+
- `/opt/socket_vmnet/bin/socket_vmnet_client`
73+
74+
You can customize the install location using the `PREFIX` environment variable,
75+
however, it is highly recommended to set the prefix to a directory that can be
76+
only written by the root. Note that `/usr/local/bin` is sometimes chowned for a
77+
non-admin user, so `/usr/local` is _not_ an appropriate prefix.
5678

5779
Run the following command to start the daemon:
5880

5981
```bash
60-
mkdir -p ${HOMEBREW_PREFIX}/var/run
61-
sudo ${HOMEBREW_PREFIX}/opt/socket_vmnet/bin/socket_vmnet --vmnet-gateway=192.168.105.1 ${HOMEBREW_PREFIX}/var/run/socket_vmnet
82+
sudo /opt/socket_vmnet/bin/socket_vmnet --vmnet-gateway=192.168.105.1 /var/run/socket_vmnet
6283
```
6384

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

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

7597
```bash
76-
# sudo is necessary for the next line
77-
sudo ${HOMEBREW_PREFIX}/bin/brew services start socket_vmnet
98+
sudo make install.launchd
7899
```
79100

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

82103
Default configuration:
83104

84-
| Config | Value |
85-
| ------- | ------------------------------------------------ |
86-
| Socket | `${HOMEBREW_PREFIX}/var/run/socket_vmnet` |
87-
| Stdout | `${HOMEBREW_PREFIX}/var/log/socket_vmnet/stdout` |
88-
| Stderr | `${HOMEBREW_PREFIX}/var/log/socket_vmnet/stderr` |
89-
| Gateway | 192.168.105.1 |
105+
| Config | Value |
106+
| ------- | ------------------------------ |
107+
| Socket | `/var/run/socket_vmnet` |
108+
| Stdout | `/var/log/socket_vmnet/stdout` |
109+
| Stderr | `/var/log/socket_vmnet/stderr` |
110+
| Gateway | 192.168.105.1 |
90111

91112
To uninstall the launchd service:
92113

93114
```bash
94-
sudo ${HOMEBREW_PREFIX}/bin/brew services stop socket_vmnet
115+
sudo make uninstall.launchd
95116
```
96117

97118
</p>
98119

99120
</details>
100121

101-
### From MacPorts
122+
### From Homebrew
123+
124+
<details>
125+
126+
<p>
102127

103128
```bash
104-
sudo port install socket_vmnet
129+
brew install socket_vmnet
105130
```
106131

107132
The binaries will be installed onto the following paths:
108133

109-
- `/opt/local/bin/socket_vmnet`
110-
- `/opt/local/bin/socket_vmnet_client`
134+
- `${HOMEBREW_PREFIX}/opt/socket_vmnet/bin/socket_vmnet`
135+
- `${HOMEBREW_PREFIX}/opt/socket_vmnet/bin/socket_vmnet_client`
111136

112-
Run the following command to start the daemon manually:
137+
The `${HOMEBREW_PREFIX}` path defaults to `/opt/homebrew` on ARM, `/usr/local` on Intel.
138+
139+
The `${HOMEBREW_PREFIX}/opt/socket_vmnet` directory is usually symlinked to `../Cellar/socket_vmnet/${VERSION}`.
140+
141+
Run the following command to start the daemon:
113142

114143
```bash
115-
sudo /opt/local/bin/socket_vmnet --vmnet-gateway=192.168.105.1 /var/run/socket_vmnet
144+
mkdir -p ${HOMEBREW_PREFIX}/var/run
145+
sudo ${HOMEBREW_PREFIX}/opt/socket_vmnet/bin/socket_vmnet --vmnet-gateway=192.168.105.1 ${HOMEBREW_PREFIX}/var/run/socket_vmnet
116146
```
117147

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

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

126159
```bash
127-
sudo port load socket_vmnet
160+
# sudo is necessary for the next line
161+
sudo ${HOMEBREW_PREFIX}/bin/brew services start socket_vmnet
128162
```
129163

130-
The launchd unit file will be installed as
131-
`/Library/LaunchDaemons/org.macports.socket_vmnet.plist`.
164+
The launchd unit file will be installed as `/Library/LaunchDaemons/homebrew.mxcl.socket_vmnet.plist`.
132165

133166
Default configuration:
134167

135-
| Config | Value |
136-
| ------- | --------------------------- |
137-
| Socket | `/var/run/socket_vmnet` |
138-
| Stdout | `/var/log/socket_vmnet.log` |
139-
| Gateway | 192.168.105.1 |
168+
| Config | Value |
169+
| ------- | ------------------------------------------------ |
170+
| Socket | `${HOMEBREW_PREFIX}/var/run/socket_vmnet` |
171+
| Stdout | `${HOMEBREW_PREFIX}/var/log/socket_vmnet/stdout` |
172+
| Stderr | `${HOMEBREW_PREFIX}/var/log/socket_vmnet/stderr` |
173+
| Gateway | 192.168.105.1 |
140174

141175
To uninstall the launchd service:
142176

143177
```bash
144-
sudo port unload socket_vmnet
178+
sudo ${HOMEBREW_PREFIX}/bin/brew services stop socket_vmnet
145179
```
146180

147181
</p>
148182

149183
</details>
150184

151-
### From source
185+
</p>
186+
187+
</details>
188+
189+
### From MacPorts
152190

153191
<details>
154192

155193
<p>
156194

157195
```bash
158-
sudo make install.bin
196+
sudo port install socket_vmnet
159197
```
160198

161-
This installs binaries using `PREFIX=/opt/socket_vmnet`:
162-
163-
- `/opt/socket_vmnet/bin/socket_vmnet`
164-
- `/opt/socket_vmnet/bin/socket_vmnet_client`
199+
The binaries will be installed onto the following paths:
165200

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

171-
Run the following command to start the daemon:
204+
Run the following command to start the daemon manually:
172205

173206
```bash
174-
sudo /opt/socket_vmnet/bin/socket_vmnet --vmnet-gateway=192.168.105.1 /var/run/socket_vmnet
207+
sudo /opt/local/bin/socket_vmnet --vmnet-gateway=192.168.105.1 /var/run/socket_vmnet
175208
```
176209

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

185218
```bash
186-
sudo make install.launchd
219+
sudo port load socket_vmnet
187220
```
188221

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

191225
Default configuration:
192226

193-
| Config | Value |
194-
| ------- | ------------------------------ |
195-
| Socket | `/var/run/socket_vmnet` |
196-
| Stdout | `/var/log/socket_vmnet/stdout` |
197-
| Stderr | `/var/log/socket_vmnet/stderr` |
198-
| Gateway | 192.168.105.1 |
227+
| Config | Value |
228+
| ------- | --------------------------- |
229+
| Socket | `/var/run/socket_vmnet` |
230+
| Stdout | `/var/log/socket_vmnet.log` |
231+
| Gateway | 192.168.105.1 |
199232

200233
To uninstall the launchd service:
201234

202235
```bash
203-
sudo make uninstall.launchd
236+
sudo port unload socket_vmnet
204237
```
205238

206239
</p>

0 commit comments

Comments
 (0)