Starting a Dev Environment with Devbox
Background
Devbox is a command-line tool that lets you easily create reproducible, reliable dev environments. You start by defining the list of packages required by your development environment, and devbox uses that definition to create an isolated environment just for your application. Developers can start a dev environment for their project by running devbox shell
.
To learn more about how Devbox works, you can read our introduction
This quickstart shows you how to install Devbox, and use it to start a development environment for a project that is configured to use Devbox via devbox.json
Install Devbox
Use the following install script to get the latest version of Devbox:
curl -fsSL https://get.jetify.com/devbox | bash
Devbox requires the Nix Package Manager. If Nix is not detected on your machine when running a command, Devbox will automatically install it for you with the default settings for your OS. Don't worry: You can use Devbox without needing to learn the Nix Language.
Start your development shell
-
Open a terminal in the project. The project should contain a
devbox.json
that specifies how to create your development environment -
Start a devbox shell for your project:
To get started, all we have to do is run:
devbox shell
Output:
Installing nix packages. This may take a while... done.
Starting a devbox shell...
(devbox) $infoThe first time you run
devbox shell
may take a while to complete due to Devbox downloading prerequisites and package catalogs required by Nix. This delay is a one-time cost, and future invocations and package additions should resolve much faster. -
Use the packages provided in your development environment
The packages listed in your project's
devbox.json
should now be available for you to use. For example, if the project'sdevbox.json
containspython@3.10
, you should now havepython
in your path:$ python --version
Python 3.10.9 -
Your host environment's packages and tools are also available, including environment variables and config settings.
git config --get user.name
-
You can search for additional packages using
devbox search <pkg>
. You can then add them to your Devbox shell by runningdevbox add [pkgs]
-
To exit the Devbox shell and return to your regular shell:
exit
Next Steps
Learn more about Devbox
- Devbox Global: Learn how to use the devbox as a global package manager
- Devbox Scripts: Automate setup steps and configuration for your shell using Devbox Scripts.
- Configuration Guide: Learn how to configure your shell and dev environment with
devbox.json
. - Browse Examples: You can see how to create a development environment for your favorite tools or languages by browsing the Devbox Examples repo.
Use Devbox with your IDE
- Direnv Integration: Devbox can integrate with direnv to automatically activate your shell and packages when you navigate to your project.
- Devbox for Visual Studio Code: Install our VS Code extension to speed up common Devbox workflows or to use Devbox in a devcontainer.
Boost your dev environment with Jetify Cloud
- Jetify Secrets: Securely store and access your secrets and environment variables in your Devbox projects.
- Jetify Deploys: Deploy your Devbox projects as autoscaling services with a single command.
- Jetify Cache: Share and cache packages across all your Devbox projects and environments.
- Jetify Prebuilt Cache: Use the Jetify Public Cache to speed up your Devbox builds and share packages with the community.
Get Involved
- Join our Discord Community: Chat with the development team and our growing community of Devbox users.
- Visit us on Github: File issues and provide feedback, or even open a PR to contribute to Devbox or our Docs.