Skip to main content
Environment variables allow you to customize the runtime environment for Minecraft instances and control launcher behavior.

Instance Environment Variables

You can set custom environment variables that will be available to Minecraft and any mods during runtime.

Configuration

Global Environment Variables

Set variables that apply to all instances:
  1. Navigate to SettingsMinecraftEnvironment Variables
  2. Add variable name-value pairs
  3. Click OK to save

Per-Instance Environment Variables

Override global variables for specific instances:
  1. Right-click an instance → Edit InstanceSettings
  2. Navigate to Environment Variables
  3. Check Override Global Settings
  4. Add or modify variables
  5. Click OK to save

Common Use Cases

MALLOC_ARENA_MAX=4
MALLOC_TRIM_THRESHOLD_=100000

Launcher-Provided Variables

These variables are automatically set by Prism Launcher and available to custom commands:
INST_NAME
string
The display name of the instance
INST_ID
string
The unique identifier of the instance (folder name)
INST_DIR
string
Absolute path to the instance root directory
INST_MC_DIR
string
Absolute path to the Minecraft game directory (usually instance_dir/minecraft or instance_dir/.minecraft)
INST_JAVA
string
Path to the Java executable used for this instance
INST_JAVA_ARGS
string
The JVM arguments used for launch
May not parse correctly if arguments contain spaces

System-Wide Launcher Variables

These environment variables affect the launcher itself and must be set before starting Prism Launcher.

Data Directory

PRISMLAUNCHER_DATA_DIR
string
Override the default data directory location
Linux/macOS
export PRISMLAUNCHER_DATA_DIR="/path/to/data"
prismlauncher
Windows (PowerShell)
$env:PRISMLAUNCHER_DATA_DIR = "C:\custom\path"
.\prismlauncher.exe
This is equivalent to using the --dir command-line argument. The command-line argument takes precedence if both are specified.

Qt Logging

QT_LOGGING_RULES
string
Control which Qt logging categories are shown in the launcher logs
Enable specific categories
export QT_LOGGING_RULES="qt.network.ssl=true;qt.network=false"
Multiple categories can be separated by semicolons (;). See Qt Logging Categories for details.
QT_MESSAGE_PATTERN
string
Customize the format of console output messages
Custom format
export QT_MESSAGE_PATTERN="[%{time process}] %{if-category}[%{category}]%{endif} %{message}"
See Qt Message Pattern for available placeholders.

Linux-Specific Variables

LD_PRELOAD
string
Preload shared libraries before running Minecraft (Linux only)
Example with custom library
export LD_PRELOAD="/path/to/library.so"
Prism Launcher may modify this variable when enabling MangoHud or other features. Your value may be appended to rather than replaced.
APPIMAGE
string
Automatically set when running from AppImage. Points to the AppImage file path.
Used internally by the launcher for updates and creating shortcuts.
These environment variables can improve Minecraft performance:

Mesa Drivers (Linux)

mesa_glthread=true
mesa_shader_cache_dir=/path/to/cache
Zink can be enabled directly in instance settings under PerformanceUse Zink. When enabled via settings, these variables are set automatically.

Memory Management

MALLOC_ARENA_MAX=4

GPU Selection

__NV_PRIME_RENDER_OFFLOAD=1
__VK_LAYER_NV_optimus=NVIDIA_only
__GLX_VENDOR_LIBRARY_NAME=nvidia
GPU selection can be enabled in instance settings under PerformanceUse Discrete GPU. When enabled, these variables are configured automatically on Linux.

Graphics and Rendering

LWJGL Variables

LWJGL_DEBUG=true

Input Method (Linux)

XMODIFIERS=@im=ibus
GTK_IM_MODULE=ibus
QT_IM_MODULE=ibus

Java-Specific Variables

JAVA_HOME
string
Override the Java installation path
Linux/macOS
export JAVA_HOME="/usr/lib/jvm/java-21-openjdk"
Prism Launcher typically manages Java installations automatically. Only use this if you have specific requirements.
JAVA_TOOL_OPTIONS
string
Additional JVM options applied to all Java processes
Example
export JAVA_TOOL_OPTIONS="-Xmx2G -Djava.io.tmpdir=/tmp/minecraft"
These options are applied in addition to those configured in instance settings.

Storage Format

Environment variables are stored as JSON in the launcher configuration:
settings.json
{
  "Env": "{\"VARIABLE_NAME\":\"value\",\"ANOTHER_VAR\":\"value2\"}"
}
For per-instance settings, they’re stored in instance.cfg:
instance.cfg
OverrideEnv=true
Env={"MY_VARIABLE":"my_value","DEBUG":"1"}

Variable Precedence

  1. System environment - Variables set in your shell or system
  2. Launcher-provided - Variables like INST_NAME, INST_DIR
  3. Global custom variables - Set in launcher global settings
  4. Instance custom variables - Set in per-instance settings (highest priority)
  5. Feature-specific - Variables set by launcher features (MangoHud, Gamemode, etc.)

Troubleshooting

Variables Not Applied

  1. Restart the launcher after setting system-wide variables
  2. Verify variables are saved in settings (check settings.json or instance.cfg)
  3. Check for typos in variable names
  4. Ensure override is enabled for instance-specific variables

Syntax Errors

Variable names and values are case-sensitive. Use exact casing as documented.

Conflicts

If launcher features (like GPU switching) conflict with manual variables:
  1. Disable the launcher feature
  2. Set variables manually
  3. Or use the launcher feature and let it manage the variables

Security Considerations

  • Avoid storing sensitive data in environment variables
  • Be cautious with LD_PRELOAD and similar injection mechanisms
  • Only use variables from trusted sources
  • Review modpack-provided environment variables before use