Settings

Settings control interpretation and execution. Each setting may be specified at most once, anywhere in the justfile.

For example:

set shell := ["zsh", "-cu"]

foo:
  # this line will be run as `zsh -cu 'ls **/*.txt'`
  ls **/*.txt

Table of Settings

NameValueDefaultDescription
allow-duplicate-recipesbooleanFalseAllow recipes appearing later in a justfile to override earlier recipes with the same name.
dotenv-loadbooleanFalseLoad a .env file, if present.
exportbooleanFalseExport all variables as environment variables.
fallbackbooleanFalseSearch justfile in parent directory if the first recipe on the command line is not found.
ignore-commentsbooleanFalseIgnore recipe lines beginning with #.
positional-argumentsbooleanFalsePass positional arguments.
shell[COMMAND, ARGS…]-Set the command used to invoke recipes and evaluate backticks.
tempdirstring-Create temporary directories in tempdir instead of the system default temporary directory.
windows-powershellbooleanFalseUse PowerShell on Windows as default shell. (Deprecated. Use windows-shell instead.
windows-shell[COMMAND, ARGS…]-Set the command used to invoke recipes and evaluate backticks.

Boolean settings can be written as:

set NAME

Which is equivalent to:

set NAME := true

Allow Duplicate Recipes

If allow-duplicate-recipes is set to true, defining multiple recipes with the same name is not an error and the last definition is used. Defaults to false.

set allow-duplicate-recipes

@foo:
  echo foo

@foo:
  echo bar
$ just foo
bar

Dotenv Load

If dotenv-load is true, a .env file will be loaded if present. Defaults to false.

Export

The export setting causes all just variables to be exported as environment variables. Defaults to false.

set export

a := "hello"

@foo b:
  echo $a
  echo $b
$ just foo goodbye
hello
goodbye

Positional Arguments

If positional-arguments is true, recipe arguments will be passed as positional arguments to commands. For linewise recipes, argument $0 will be the name of the recipe.

For example, running this recipe:

set positional-arguments

@foo bar:
  echo $0
  echo $1

Will produce the following output:

$ just foo hello
foo
hello

When using an sh-compatible shell, such as bash or zsh, $@ expands to the positional arguments given to the recipe, starting from one. When used within double quotes as "$@", arguments including whitespace will be passed on as if they were double-quoted. That is, "$@" is equivalent to "$1" "$2"… When there are no positional parameters, "$@" and $@ expand to nothing (i.e., they are removed).

This example recipe will print arguments one by one on separate lines:

set positional-arguments

@test *args='':
  bash -c 'while (( "$#" )); do echo - $1; shift; done' -- "$@"

Running it with two arguments:

$ just test foo "bar baz"
- foo
- bar baz

Shell

The shell setting controls the command used to invoke recipe lines and backticks. Shebang recipes are unaffected.

# use python3 to execute recipe lines and backticks
set shell := ["python3", "-c"]

# use print to capture result of evaluation
foos := `print("foo" * 4)`

foo:
  print("Snake snake snake snake.")
  print("{{foos}}")

just passes the command to be executed as an argument. Many shells will need an additional flag, often -c, to make them evaluate the first argument.

Windows Shell

just uses sh on Windows by default. To use a different shell on Windows, use windows-shell:

set windows-shell := ["powershell.exe", "-NoLogo", "-Command"]

hello:
  Write-Host "Hello, world!"

See powershell.just for a justfile that uses PowerShell on all platforms.

Windows PowerShell

set windows-powershell uses the legacy powershell.exe binary, and is no longer recommended. See the windows-shell setting above for a more flexible way to control which shell is used on Windows.

just uses sh on Windows by default. To use powershell.exe instead, set windows-powershell to true.

set windows-powershell := true

hello:
  Write-Host "Hello, world!"
Python 3
set shell := ["python3", "-c"]
Bash
set shell := ["bash", "-uc"]
Z Shell
set shell := ["zsh", "-uc"]
Fish
set shell := ["fish", "-c"]
Nushell
set shell := ["nu", "-c"]

If you want to change the default table mode to light:

set shell := ['nu', '-m', 'light', '-c']

Nushell was written in Rust, and has cross-platform support for Windows / macOS and Linux.