DEV Community

Paolo Carraro
Paolo Carraro

Posted on

Mise-En-Place: a quick and easy tool for managing a dev environment

(ITA version)

For a few months now, I've been using Mise En Place as a tool to manage my environments: from macro (entire virtual machine) to micro (single project).

Frustrated by always having to start from scratch when creating a new virtual machine with WSL2, this tool was suggested to me, and I've come to appreciate it more and more for its ease of use, speed, and consistency.

It's the classic "Swiss Army knife" tool that allows you to manage tools and their versions in a specific project or across the entire machine, load a project's environment variables when you enter the project folder, and manage the tasks/scripts you want to use to automate the project itself.

After the quick installation using the script indicated here, you can explore the commands with
mise help
The extensive list of available commands is immediately noticeable. I will limit myself here to commenting on the ones I use most often, which concern tool management.

mise list | ls

This command allows you to see the list of all installed packages, highlighting those that are active and those currently unavailable. This is because some packages might only become active when you enter the folder where the use of that tool in that specific version has been configured. The entire list thus indicates all dependencies installed in the local cache.

mise list screenshot

mise use | install

use is the command most often invoked to install a tool; let's look at some examples of usage:
mise use -g go
With this command, we install Go at the latest version and make it globally available. The global configuration is available at the path ./config/mise/config.toml.

~/my-projects/project-a/mise use node@19
With this command, we configure the use of version 19 of Nodejs (the most recent minor and patch version of the indicated major will be downloaded). This version of Nodejs will be activated every time we enter the project folder. We will notice that in this case, mise will have created the configuration file mise.toml for us. If mise does not find Nodejs 19 available in the cache when entering the project folder, it will raise a warning. At that point, it will be enough to run the command mise install to download the required dependencies.

The difference between use and install is that use installs and configures, while install downloads the dependency into the cache, thus making it available later if configured via mise.toml.
Note that by having mise ls node show us the list of available Nodejs versions, it clearly indicates the active version, the source that configured it, and what version was requested

Mise allows you to easily try downloading a tool by only indicating its name; it will then resolve this name with one or more backends that implement it.
mise backend screenshot
As you can see, this tool can be resolved with various backends that make it available. Among these backends, we also find well-known package managers like cargo and npm, or languages that offer installation capabilities like Go. Some, like ubi, for example, use releases available on Github.

The counterparts to use and install for removing dependencies are unuse and uninstall.

mise which

This command allows you to see where the binary of the application you are using is located.

mise which screenshot

This gives us an idea of how mise uses the cache through shims, a system similar to middleware for manipulating the PATH of our shell in this case.

mise cache

mise outdated

This command creates a report showing the status of every installed tool whose version is not up-to-date compared to the version initially requested, which is 'latest' by default.

mise upgrade

This command handles updating all versions in accordance with the version requested during configuration with use.

mise prune

This command allows you to clean up all dependencies that are no longer used (i.e., not listed in any configuration file). Confirmation is still requested for each one before removal.

mise search <tool-name>

This command allows you to search the mise registry to see if the indicated tool is available so you can then install and use it.

mise search result screenshot

mise helix npm and lsp

Using Helix as my editor, I download several LSPs for managing codebases in various languages. BUT with LSPs distributed via npm, especially in the frontend/html context, my experience with mise has not been optimal, as Helix cannot find them available unless I go and define the path created by mise in the languages.toml configuration file. For now, I have returned to using pnpm as a global package manager.

Did you already know about mise? What has your experience been using it?

Top comments (0)