You can use Flox to set up an environment for a new or existing project. Flox environments can either be activated in a new sub-shell or within the current shell, and they provide dependencies that take precedence over dependencies you may have installed on your system. Your existing dependencies are not modified in any way. When you leave the Flox environment everything will return to its original state. This guide uses anDocumentation Index
Fetch the complete documentation index at: https://flox.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
example-project but you can follow along in your own
projects as well.
Initialize a project
Let’s set up a project calledexample-project using the
flox init command:
.flox directory wherever you ran
flox init.
This is where an environment’s declarative configuration is stored by default,
and can be checked into version control.
Search, show, and install packages
We have an environment, but it’s empty. Flox has over 80,000 open source and licensable packages to install in your environment. Search for and install packages usingflox search,
flox show, and flox install.
Let’s assume example-project is a nodejs/npm project.
Begin by searching for nodejs with flox search in Flox:
NoteDon’t see what you’re looking for? Try
flox search <search-term> --all.
Still missing? Reach out to us on our forum for assistance.flox show.
Here we’re showing nodejs:
flox install.
NoteFlox will warn you if you install a package that requires licensing.
Ensure you have a license for the package before using it with Flox.
Enter and use the environment
Now we need to activate the environment with theflox activate command to make the packages we installed
available.
When an environment is activated,
you will see your terminal’s prompt change.
This example demonstrates that the packages are now available by running
which node and which mkcert.
NoteSome terminal themes may override Flox’s terminal prompt changes.
You will still be able to activate and use the environment.
Customize the shell hook and environment variables
The activation process of your Flox environment can be customized by editing the environment’s declarative manifest withflox edit.
This is useful for doing environment initialization,
safely working with secrets,
printing instructions for other developers,
and more.
Let’s add a simple instruction to example-project’s environment.
To interactively edit and validate your environment,
use Flox’s built-in edit function which uses your default terminal $EDITOR:
[hook] block:
manifest.toml
NoteEdits made with
flox edit will be validated and built
immediately.
Edits made to the manifest with external software like
an IDE will be validated when you run flox activate.exit and
flox activate again:
Exit the environment
We’re done! To exit the last environment activated, use theexit command or the shell shortcut, CTRL + D.