How to Set AIRFLOW_HOME for Apache Airflow®
Apache Airflow® keeps everything it creates in one folder: its settings file, its database, its logs and the admin password. Unless you tell it otherwise, that folder is ~/airflow in your home folder, shared by every project. The AIRFLOW_HOME environment variable points Airflow at a folder of your choice instead. This guide shows both, on Airflow 3.4.0.
Syntax
export AIRFLOW_HOME=<folder>
| Part | What it means |
|---|---|
export | Sets an environment variable for this terminal and every program you start from it |
AIRFLOW_HOME | The variable Airflow reads to find its folder |
<folder> | The folder to use. "$PWD" means the folder you're in, which is usually your project |
Airflow's Quick Start: "Airflow keeps its files in ~/airflow unless you set AIRFLOW_HOME."
Prerequisites
- Apache Airflow® installed in a virtual environment, and that environment activated. Check with
airflow version.
Step 1: See What Happens Without It
In a terminal where AIRFLOW_HOME isn't set, ask Airflow where it looks for Dags:
echo "AIRFLOW_HOME=$AIRFLOW_HOME"
airflow config get-value core dags_folder
ls ~/airflow
AIRFLOW_HOME=
/Users/you/airflow/dags
airflow.cfg logs

The variable is empty, so Airflow used ~/airflow. That one command was enough for it to create the folder, with a new airflow.cfg and a logs folder in it. (I left out the two FileType is deprecated warnings that every command prints on Python 3.14.)
Step 2: Point It at Your Project
In your project folder:
export AIRFLOW_HOME="$PWD"
echo "AIRFLOW_HOME=$AIRFLOW_HOME"
airflow config get-value core dags_folder
ls
AIRFLOW_HOME=/Users/you/source/airflow-home-demo
/Users/you/source/airflow-home-demo/dags
airflow.cfg logs

Now everything is in the project: the Dags folder is dags inside it, and Airflow created its own airflow.cfg and logs there. The quotes around "$PWD" keep a folder name with spaces in one piece.
Step 3: Set It Again in Every New Terminal
export only lasts as long as the terminal. Open a new one and check:
echo "AIRFLOW_HOME=$AIRFLOW_HOME"
AIRFLOW_HOME=

It's empty again. Every time you open a terminal for this project, go to its folder and run the export line before any airflow command. Airflow's Quick Start warns why: a terminal without it uses ~/airflow, "with a separate database and password".
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
Setting it after the first airflow command | Airflow has already created ~/airflow | Export it first; delete ~/airflow if you don't use it |
AIRFLOW_HOME=$PWD without export | Only that shell knows the variable; airflow doesn't see it | Use export |
| Running the export in another folder | Airflow uses that folder instead | cd into the project first |
| Forgetting it in a second terminal | That terminal's commands use ~/airflow and another database | Export it in every terminal |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Your Dags or runs are suddenly missing | This terminal uses ~/airflow, not your project | echo $AIRFLOW_HOME, then export it |
A ~/airflow folder you didn't create | An airflow command ran without the variable | Delete it if you don't use it |
| The admin password doesn't work | The two folders have different passwords | Read the password file in the folder Airflow is using |
FAQ
Does Airflow create the folder?
It creates its own files in it, airflow.cfg and logs, the first time a command needs them. ~/airflow itself was created when it didn't exist.
Can I put AIRFLOW_HOME somewhere other than the project?
Yes, any folder works. Keeping it in the project means each project has its own settings and database.
Does this work in PowerShell?
Airflow runs on Windows only inside WSL2, where you use bash and the same export line.
Conclusion
Without AIRFLOW_HOME, airflow config get-value core dags_folder used ~/airflow and created it. With export AIRFLOW_HOME="$PWD", the same command used the project folder and created airflow.cfg and logs there, and a new terminal started out without the variable again.
Additional Resources
- Quick Start —
AIRFLOW_HOMEand starting Airflow again later. - Setting configuration options —
airflow.cfgand where Airflow reads it from.
Apache®, Apache Airflow and Airflow® are either registered trademarks or trademarks of The Apache Software Foundation in the United States and/or other countries. No endorsement by The Apache Software Foundation is implied by the use of these marks.
