You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Add a section on how to use environment variables (jdx#4435)
- update env. vars page to indicate under which conditions they work
- small updates to backend/plugins/registry pages
- clarify that `mise alias` command is only for version aliases (not
backend aliases)
Copy file name to clipboardExpand all lines: docs/dev-tools/backends/asdf.md
+9-4Lines changed: 9 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,17 @@
1
1
# asdf Backend
2
2
3
-
asdf is the original backend for mise. It relies on asdf plugins for each tool. asdf plugins are
4
-
more risky to use because they're typically written by a single developer unrelated to the tool vendor
5
-
they also do not function on Windows.
3
+
`asdf` is the original backend for mise.
4
+
5
+
It relies on asdf plugins for each tool. asdf plugins are more risky to use because they're typically written by a single developer unrelated to the tool vendor. They also do not function on Windows.
6
+
7
+
asdf plugins are not used for tools inside the [registry](https://github.com/jdx/mise/blob/main/registry.toml) whenever possible. Sometimes it is not possible to use more secure backends like aqua/ubi because tools have complex install setups or need to export env vars.
8
+
9
+
All of these are hosted in the mise-plugins org to secure the supply chain so you do not need to rely on plugins maintained by anyone except me.
10
+
6
11
Because of the extra complexity of asdf tools and security concerns we are actively moving tools in
7
12
the registry away from asdf where possible to backends like aqua and ubi which don't require plugins.
8
13
That said, not all tools can function with ubi/aqua if they have a unique installation process or
Copy file name to clipboardExpand all lines: docs/dev-tools/backends/index.md
+7-3Lines changed: 7 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,12 @@
1
1
# Backends
2
2
3
-
In addition to asdf plugins, you can also directly install CLIs with some package managers.
3
+
Backends are the way mise installs [tools](/dev-tools/) and [plugins](/plugins.html). Each backend is responsible for managing the installation and usage of a specific type of tool or package manager. This allows mise to support a wide variety of tools and languages by leveraging different backends.
4
4
5
-
-[asdf](/dev-tools/backends/asdf)
5
+
When you run the [`mise use`](/cli/use.html) command, mise will determine the appropriate backend to use based on the tool you are trying to manage. The backend will then handle the installation, configuration, and any other necessary steps to ensure the tool is ready to use.
6
+
7
+
Below is a list of the available backends in mise:
8
+
9
+
-[asdf](/dev-tools/backends/asdf) (provide tools through [plugins](/plugins.html))
Copy file name to clipboardExpand all lines: docs/dev-tools/index.md
+2-7Lines changed: 2 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,9 @@
4
4
> or [pyenv](https://github.com/pyenv/pyenv) but for any language), it manages dev tools like node,
5
5
> python, cmake, terraform, and [hundreds more](/registry.html)._
6
6
7
-
::: tip
8
-
New developer? Try reading the [Beginner's Guide](https://dev.to/jdxcode/beginners-guide-to-rtx-ac4)
9
-
for a gentler introduction.
10
-
:::
11
-
12
-
mise is a tool that manages installations of programming language runtimes and other tools for local development. For example, it can be used to manage multiple versions of Node.js, Python, Ruby, Go, etc. on the same machine.
7
+
`mise` is a tool that manages installations of programming language runtimes and other tools for local development. For example, it can be used to manage multiple versions of Node.js, Python, Ruby, Go, etc. on the same machine.
13
8
14
-
Once [activated](/getting-started.html#activate-mise), mise will automatically switch between different versions of tools based on the directory you're in.
9
+
Once [activated](/getting-started.html#activate-mise), mise can automatically switch between different versions of tools based on the directory you're in.
15
10
This means that if you have a project that requires Node.js 18 and another that requires Node.js 22, mise will automatically switch between them as you move between the two projects. See tools available for mise with in the [registry](/registry).
16
11
17
12
To know which tool version to use, mise will typically look for a `mise.toml` file in the current directory and its parents. To get an idea of how tools are specified, here is an example of a [mise.toml](/configuration.html) file:
Copy file name to clipboardExpand all lines: docs/environments/index.md
+73-9Lines changed: 73 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,9 @@
4
4
> manages _environment variables_ for
5
5
> different project directories.
6
6
7
-
Use mise to specify environment variables used for different projects. Create a `mise.toml` file
8
-
in the root of your project directory:
7
+
Use mise to specify environment variables used for different projects.
8
+
9
+
To get started, create a `mise.toml` file in the root of your project directory:
9
10
10
11
```toml [mise.toml]
11
12
[env]
@@ -22,13 +23,76 @@ NODE_ENV = false # unset a previously set NODE_ENV
22
23
You can also use the CLI to get/set env vars:
23
24
24
25
```sh
25
-
$ mise set NODE_ENV=development
26
-
$ mise set NODE_ENV
27
-
development
28
-
$ mise set
29
-
key value source
30
-
NODE_ENV development mise.toml
31
-
$ mise unset NODE_ENV
26
+
mise set NODE_ENV=development
27
+
# mise set NODE_ENV
28
+
# development
29
+
30
+
mise set
31
+
# key value source
32
+
# NODE_ENV development mise.toml
33
+
34
+
cat mise.toml
35
+
# [env]
36
+
# NODE_ENV = 'development'
37
+
38
+
mise unset NODE_ENV
39
+
```
40
+
41
+
Additionally, the [mise env [--json][--dotenv]](/cli/env.html) command can be used to export the environment variables in various formats (including `PATH` and environment variables set by tools or plugins).
42
+
43
+
## Using environment variables
44
+
45
+
Environment variables are available when using [`mise x|exec`](/cli/exec.html), or with [`mise r|run`](/cli/run.html) (i.e. with [tasks](/tasks/)):
46
+
47
+
```shell
48
+
mise set MY_VAR=123
49
+
mise exec -- echo$MY_VAR
50
+
# 123
51
+
```
52
+
53
+
You can of course combine them with [tools](/dev-tools/):
54
+
55
+
```sh
56
+
mise use node@22
57
+
mise set MY_VAR=123
58
+
cat mise.toml
59
+
# [tools]
60
+
# node = '22'
61
+
# [env]
62
+
# MY_VAR = '123'
63
+
mise exec -- node --eval 'console.log(process.env.MY_VAR)'
64
+
# 123
65
+
```
66
+
67
+
If [mise is activated](/getting-started.html#activate-mise), it will automatically set environment variables in the current shell session when you `cd` into a directory.
68
+
69
+
```shell
70
+
cd /path/to/project
71
+
mise set NODE_ENV=production
72
+
cat mise.toml
73
+
# [env]
74
+
# NODE_ENV = 'production'
75
+
76
+
echo$NODE_ENV
77
+
# production
78
+
```
79
+
80
+
If you are using [`shims`](/dev-tools/shims.html), the environment variables will be available when using the shim:
Copy file name to clipboardExpand all lines: docs/plugins.md
+23-9Lines changed: 23 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,34 @@
1
1
# Plugins
2
2
3
-
Plugins in mise extend functionality. Historically they were the only way to add new tools as the only backend was asdf. The way
4
-
that backend works is every tool has its own plugin which needs to be manually installed. However now with core languages and
5
-
backends like aqua/ubi, plugins are no longer necessary to run most tools in mise.
3
+
Plugins in mise are a way to extend `mise` with new functionality like extra tools or environment variable management.
6
4
7
-
Meanwhile, plugins have expanded beyond tools and can provide functionality like [setting env vars globally](/environments/#plugin-provided-env-directives) without relying on a tool being installed.
5
+
Historically it was the only way to add new tools (as the only backend was [asdf](/dev-tools/backends/asdf.html)).
6
+
7
+
The way that backend works is every tool has its own plugin which needs to be manually installed. However, now with [core tools](/core-tools.html)
8
+
and backends like [aqua](/dev-tools/backends/aqua.html)/[ubi](/dev-tools/backends/ubi.html), plugins are no longer necessary to run most tools in mise.
8
9
9
10
Tool plugins should be avoided for security reasons. New tools will not be accepted into mise built with asdf/vfox plugins unless they are very popular and
10
11
aqua/ubi is not an option for some reason.
12
+
13
+
The only exception is if the tool needs to set env vars or has a complex installation process, as plugins can provide functionality like [setting env vars globally](/environments/#plugin-provided-env-directives) without relying on a tool being installed. They can also provide [aliases for versions](/dev-tools/aliases.html#aliased-versions).
14
+
11
15
If you want to integrate a new tool into mise, you should either try to get it into the [aqua registry](https://mise.jdx.dev/dev-tools/backends/aqua.html)
12
16
or see if it can be installed with [ubi](https://mise.jdx.dev/dev-tools/backends/ubi.html). Then add it to the [registry](https://github.com/jdx/mise/blob/main/registry.toml).
13
17
Aqua is definitely preferred to ubi as it has better UX and more features like slsa verification and the ability to use different logic for older versions.
14
18
19
+
You can manage all installed plugins in `mise` with [`mise plugins`](/cli/plugins.html).
20
+
21
+
```shell
22
+
mise plugins ls --urls
23
+
# Plugin Url Ref Sha
24
+
# 1password https://github.com/mise-plugins/mise-1password-cli.git HEAD f5d5aab
25
+
# vfox-mise-plugins-vfox-dart https://github.com/mise-plugins/vfox-dart HEAD 1424253
26
+
# ...
27
+
```
28
+
15
29
## asdf Plugins
16
30
17
-
mise uses asdf's plugin ecosystem under the hood. These plugins contain shell scripts like
31
+
mise can use asdf's plugin ecosystem under the hood. These plugins contain shell scripts like
18
32
`bin/install` (for installing) and `bin/list-all` (for listing all of the available versions).
19
33
20
34
See <https://github.com/jdx/mise/blob/main/registry.toml> for the list of built-in plugins shorthands. See asdf's
@@ -23,7 +37,7 @@ more about how they work.
23
37
24
38
## vfox Plugins
25
39
26
-
Similarly, mise can also use [vfox plugins](https://mise.jdx.dev/dev-tools/backends/vfox.html). These have the advantage of working on Windows so are preferred.
40
+
Similarly, mise can also use [vfox plugins](/dev-tools/backends/vfox.html). These have the advantage of working on Windows so are preferred.
27
41
28
42
## Plugin Authors
29
43
@@ -40,13 +54,13 @@ of tools. One example of this is virtualenv on python runtimes:
40
54
41
55
```toml
42
56
[tools]
43
-
python = {version='3.11', virtualenv='.venv'}
57
+
python = {version='3.11', virtualenv='.venv'}
44
58
```
45
59
46
60
This will be passed to all plugin scripts as `MISE_TOOL_OPTS__VIRTUALENV=.venv`. The user can specify
47
-
any option and it will be passed to the plugin in that format.
61
+
any option, and it will be passed to the plugin in that format.
48
62
49
-
Currently this only supports simple strings, but we can make it compatible with more complex types
63
+
Currently, this only supports simple strings, but we can make it compatible with more complex types
50
64
(arrays, tables) fairly easily if there is a need for it.
0 commit comments