docs: add env var setup for macOS and Windows GUI (#8181)

* docs: add env var setup for macOS and Windows GUI

* style-and-cleanup

* docs-review

* add-env-vars-to-troubleshooting

* Update docs/docs/Get-Started/get-started-installation.md

* Apply suggestions from code review

Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>

* docs-review

---------

Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com>
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
This commit is contained in:
Ítalo Johnny 2025-07-10 15:30:22 -03:00 • committed by GitHub
commit 76fbcf4d55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 101 additions and 0 deletions

View file

@ -388,3 +388,99 @@ To run Langflow using the above VSCode `tasks.json` file, in the VSCode command
</TabItem> </TabItem>
</Tabs> </Tabs>
## Set environment variables for Langflow Desktop
Environment variables set in your terminal aren't automatically available to GUI-based applications like Langflow Desktop when you launch them from the Windows or macOS GUI.
For Windows, this means any GUI-based app launched from the Start menu, desktop shortcuts, or Windows Explorer.
For macOS, this means any GUI-based app launched from Finder, Spotlight, Launchpad, or the Dock.
To set environment variables for Langflow Desktop, you need to use specific commands or files, depending on your OS.
<Tabs groupId="">
<TabItem value="macOS" label="macOS" default>
Langflow Desktop for macOS cannot automatically use variables set in your terminal, such as those in`.zshrc` or `.bash_profile`, when launched from the macOS GUI.
To make environment variables available to GUI apps on macOS, you need to use `launchctl` with a `plist` file:
1. Create the `LaunchAgents` directory if it doesn't exist:
```bash
mkdir -p ~/Library/LaunchAgents
```
2. In the `LaunchAgents` directory, create a `.plist` file called `dev.langflow.env`.
3. Add the following content to `dev.langflow.env.plist`, and then add, change, or remove Langflow environment variables as needed for your configuration.
This example sets the `LANGFLOW_CONFIG_DIR` environment variable for all GUI apps launched from the macOS GUI.
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>dev.langflow.env</string>
<key>ProgramArguments</key>
<array>
<string>launchctl</string>
<string>setenv</string>
<string>LANGFLOW_CONFIG_DIR</string>
<string>/Users/your_user/custom/config</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
```
4. Load the file with `launchctl`:
```bash
launchctl load ~/Library/LaunchAgents/dev.langflow.env.plist
```
</TabItem>
<TabItem value="System Properties" label="System Properties">
Langflow Desktop for Windows cannot automatically use variables set in your terminal, such as those defined with `set` in `cmd` or `$env:VAR=...` in PowerShell, when launched from the Windows GUI.
To make environment variables available to the Langflow Desktop app, you must set them at the user or system level using the **System Properties** interface or the Terminal.
To set environment variables using the System Properties interface, do the following:
1. Press <kbd>Win + R</kbd>, enter `SystemPropertiesAdvanced`, and then press <kbd>Enter</kbd>.
2. Click **Environment Variables**.
3. Under **User variables**, click **New**.
:::tip
To apply the setting to all users, select **System variables**.
:::
4. Enter the name of the Langflow variable you want to set, such as `LANGFLOW_CONFIG_DIR`, and the desired value, such as `C:\Users\your_user\.langflow_config`.
5. Click **OK** to save the variable.
6. Repeat until you have set all necessary Langflow environment variables.
7. Launch or restart Langflow Desktop to apply the environment variables.
</TabItem>
<TabItem value="Powershell" label="Powershell">
To define environment variables for Windows using PowerShell, do the following:
1. Enter the name of the Langflow variable you want to set, such as `LANGFLOW_CONFIG_DIR`, and the desired value, such as `C:\Users\your_user\.langflow_config`.
To set an environment variable for the current user:
```powershell
[System.Environment]::SetEnvironmentVariable("LANGFLOW_CONFIG_DIR", "C:\Users\your_user\.langflow_config", "User")
```
To set an environment variable for all users (you must have Administrator priveleges):
```powershell
[System.Environment]::SetEnvironmentVariable("LANGFLOW_CONFIG_DIR", "C:\Langflow\Config", "Machine")
```
2. Repeat until you have set all necessary Langflow environment variables.
3. Launch or restart Langflow Desktop to apply the environment variables.
</TabItem>
</Tabs>

View file

@ -112,6 +112,11 @@ There are two possible reasons for this error:
* **Version conflict during installation**: Some version conflicts might have occurred during the installation process. To resolve this issue, reinstall Langflow and its dependencies by running `python -m pip install langflow --pre -U --force-reinstall`. * **Version conflict during installation**: Some version conflicts might have occurred during the installation process. To resolve this issue, reinstall Langflow and its dependencies by running `python -m pip install langflow --pre -U --force-reinstall`.
### Environment variables not available from terminal
Environment variables set in your terminal are not automatically available to GUI-based applications like Langflow Desktop when launched through the Finder or the Start Menu.
To set environment variables for Langflow Desktop, see [Set environment variables for Langflow Desktop](/environment-variables#set-environment-variables-for-langflow-desktop).
### Package is not installed ### Package is not installed
In Langflow OSS, you can follow the error message's instructions to install the missing dependency. In Langflow OSS, you can follow the error message's instructions to install the missing dependency.