Skip to content

Commit 0757e27

Browse files
authored
Merge pull request #150 from MatrixAI/feature-path-installation
Docs: Clarify Linux PATH setup for manual Polykey installation
2 parents 910eca0 + bb5a78c commit 0757e27

File tree

1 file changed

+103
-42
lines changed

1 file changed

+103
-42
lines changed

docs/Getting-Started/polykey-cli/installation.md

Lines changed: 103 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -53,62 +53,108 @@ directly via the terminal using a prebuilt binary.
5353

5454
2. Make it executable:
5555

56-
```sh
57-
chmod u+x ./polykey
58-
```
56+
```sh
57+
chmod u+x ./polykey
58+
```
5959

60-
3. Move it into a directory in your
61-
$PATH, or add the current directory to your
62-
$PATH temporarily:
60+
3. Add the executable to your PATH
6361

64-
4. Confirm the installation:
62+
To run `polykey` from anywhere, you need to add the directory containing it to
63+
your `PATH`. You can either:
6564

66-
```sh
67-
polykey --version
68-
```
65+
- Move `polykey` into an existing directory already in your `PATH` (e.g.,
66+
`/usr/local/bin`), **or**
67+
- Add the polykey directory to your `PATH`, either temporarily or permanently:
6968

70-
5. If it returns the version, you’re ready to use the CLI.
69+
**Temporarily (until terminal closes):**
7170

72-
:::important Important
71+
```shell
72+
export PATH="$HOME/Downloads:$PATH"
73+
```
7374

74-
Once you start a long‑lived command like `polykey agent start`, that process
75-
monopolizes the current terminal window. To issue any further Polykey commands
76-
(for example, `polykey vaults create`) you must open a **new terminal window**.
75+
**Permanently:**
7776

78-
If the machine reboots or the agent exits, simply rerun `polykey agent start` in
79-
a terminal to restart it.
77+
<Tabs>
78+
<TabItem value="zsh" label="For zsh">
79+
To permanently add `polykey` to `PATH` on zsh, run the following command.
8080

81-
:::
81+
```shell
82+
echo 'export PATH="$HOME/Downloads:$PATH"' >> ~/.zshrc && source ~/.zshrc
83+
```
8284

83-
- For ZSH:
85+
</TabItem>
86+
<TabItem value="bash" label="For bash">
87+
To permanently add `polykey` to `PATH` on bash, run the following command.
8488

8589
```shell
86-
export PATH=~/Downloads:$PATH >> ~/.zshrc && source ~/.zshrc
90+
echo 'export PATH="$HOME/Downloads:$PATH"' >> ~/.bashrc && source ~/.bashrc
8791
```
8892

89-
- For Bash:
93+
</TabItem>
94+
</Tabs>
95+
96+
---
97+
98+
:::tip Setting PATH across operating systems
99+
100+
Where you place the `polykey` binary — and how you add it to your `PATH`
101+
depends on your OS:
102+
103+
- **Linux**: Preferred location is `~/.local/bin` (you may need to create it
104+
using `mkdir -p ~/.local/bin`). Make sure this directory is included in your
105+
`$PATH` — often via `~/.bashrc`, `~/.bash_profile`, or `~/.profile`.
106+
107+
- **macOS**: Same as Linux — use `~/.local/bin` or `~/bin`. Update your `$PATH`
108+
in `~/.zshrc` (ZSH is default on macOS since Catalina) or `~/.bash_profile` if
109+
using Bash.
110+
111+
- **Windows**: Place `polykey.exe` into:
90112

91113
```shell
92-
export PATH=~/Downloads:$PATH >> ~/.bashrc && source ~/.bashrc && source
114+
%USERPROFILE%\AppData\Local\Microsoft\WindowsApps
115+
```
116+
117+
This location is typically already included in the system PATH.
118+
119+
To verify it’s working, run:
120+
121+
```shell
122+
which polykey
123+
polykey --version
93124
```
94125

95-
4. Confirm the installation:
96-
```sh
97-
polykey --version
98-
```
126+
:::
127+
128+
4. Confirm the installation with:
129+
130+
```shell
131+
polykey --version
132+
```
99133

100134
If it returns the version, you’re ready to use the CLI.
101135

136+
:::important Important
137+
138+
Once you start a long‑lived command like `polykey agent start`, that process
139+
monopolizes the current terminal window. To issue any further Polykey commands
140+
(for example, `polykey vaults create`) you must open a **new terminal window**.
141+
142+
If the machine reboots or the agent exits, simply rerun `polykey agent start` in
143+
a terminal to restart it.
144+
145+
:::
146+
102147
:::tip Tip
103148

104149
If you see an error like:
105150

106-
WARN:polykey.PolykeyAgent:Failed Creating PolykeyAgent — another agent may
107-
already be running
151+
```
152+
WARN:polykey.PolykeyAgent:Failed Creating PolykeyAgent — another agent may already be running
153+
```
108154

109155
This means the Polykey agent is already running. To manage this, you can:
110156

111-
- **Check the agent status**:
157+
**Check the agent status**:
112158

113159
```shell
114160
polykey agent status
@@ -121,12 +167,12 @@ status DEAD
121167
```
122168

123169
Then the agent is inactive and needs to be restarted. If it returns something
124-
other than this, then it is still active!
170+
other than this, then it is still active.
125171

126172
Stop the running agent:
127173

128174
```shell
129-
polykey agent
175+
polykey agent stop
130176
```
131177

132178
You must stop the current agent or use a different terminal before starting a
@@ -144,19 +190,19 @@ However, it is easy enough to install it from source.
144190
Clone the repository:
145191

146192
```sh
147-
$ git clone https://github.com/MatrixAI/Polykey-CLI.git
193+
git clone https://github.com/MatrixAI/Polykey-CLI.git
148194
```
149195

150196
Enter the `nix-shell`:
151197

152198
```sh
153-
$ nix-shell
199+
nix-shell
154200
```
155201

156202
Build the application and install it into the user profile:
157203

158204
```sh
159-
$ nix-env -f ./release.nix --install --attr application --argstr npmDepsHash "$(prefetch-npm-deps ./package-lock.json)"
205+
nix-env -f ./release.nix --install --attr application --argstr npmDepsHash "$(prefetch-npm-deps ./package-lock.json)"
160206
```
161207

162208
### Other
@@ -272,16 +318,21 @@ not appear in the next step. :::
272318
sudo ./polykey
273319
```
274320

275-
:::tip Tip When prompted in the terminal, type your administrator password and
276-
hit enter. :::
321+
:::tip Tip
322+
323+
When prompted in the terminal, type your administrator password and hit enter.
324+
325+
:::
277326

278327
5. Following this, you will get another similar prompt
279328

280329
![install3](/images/mac-install3.png)
281330

282331
#### Click on Open and now Polykey-CLI should be running in your terminal window.
283332

284-
:::tip Tip You can also verify the version of polykey that was installed with:
333+
:::tip Tip
334+
335+
You can also verify the version of polykey that was installed with:
285336

286337
```sh
287338
./polykey --version
@@ -314,25 +365,35 @@ a terminal to restart it.
314365

315366
If you see an error like:
316367

317-
WARN:polykey.PolykeyAgent:Failed Creating PolykeyAgent — another agent may
318-
already be running
368+
```
369+
WARN:polykey.PolykeyAgent:Failed Creating PolykeyAgent — another agent may already be running
370+
```
319371

320372
This means the Polykey agent is already running. To manage this, you can:
321373

322-
- **Check the agent status**:
374+
**Check the agent status**:
323375

324376
```shell
325377
polykey agent status
326378
```
327379

380+
If the agent returns something like this:
381+
382+
```shell
383+
status DEAD
384+
```
385+
386+
Then the agent is inactive and needs to be restarted. If it returns something
387+
other than this, then it is still active.
388+
328389
Stop the running agent:
329390

330391
```shell
331392
polykey agent stop
332393
```
333394

334395
You must stop the current agent or use a different terminal before starting a
335-
new one.
396+
new one. The currently running agent must be stopped before it can be re-run.
336397

337398
:::
338399

@@ -411,7 +472,7 @@ terminal.
411472
</TabItem>
412473
<TabItem value="windows" label="Windows">
413474

414-
:::warning
475+
:::warning Warning
415476

416477
Polykey for windows should be working but we have yet to create documentation on
417478
the installation process for this. Check back soon!

0 commit comments

Comments
 (0)