How to Change TeX Live’s Package Directory on Windows
At a glance
- 1. Choose the right tree
Use TEXMFHOME for packages in a custom user folder; don’t move TeX Live’s managed package tree by hand.
- 2. Set the folder
Set the Windows user environment variable TEXMFHOME to your preferred directory, then restart TeX applications.
- 3. Install or copy files
Use tlmgr user mode for supported packages, or place manually installed files in the TeX directory structure.
- 4. Check the result
Use kpsewhich to confirm TeX Live sees the new location and can find the package file.
TeX Live normally installs managed packages into its own system tree, often under a folder such as C:\texlive\2025\texmf-dist. If you want packages in another folder, the safe approach is to create a user tree and point TeX Live to it with the TEXMFHOME environment variable. This keeps your files separate from TeX Live’s managed files and avoids disrupting updates.
If you mean that you want to move the entire TeX Live installation, that is different: reinstall TeX Live to the desired root directory rather than moving the existing installation folder manually.
Set a custom user package folder
Choose a folder for your personal TeX files. For example, you might use D:\TeX\texmf. Set TEXMFHOME as a user environment variable in Windows:
- Open Settings and search for Edit environment variables for your account.
- Under User variables, choose New (or select
TEXMFHOMEand choose Edit). - Set the variable name to
TEXMFHOMEand its value toD:\TeX\texmf. - Close and reopen your command prompt, TeX editor, or other application that runs TeX.
You can also set it from PowerShell. This stores the variable for your Windows user account:
[Environment]::SetEnvironmentVariable("TEXMFHOME", "D:\TeX\texmf", "User")
The setting does not update applications that are already open. To test it immediately in the current PowerShell session, you can also run:
$env:TEXMFHOME = 'D:\TeX\texmf'
The default user tree is commonly a texmf folder under your home directory. Setting TEXMFHOME changes that location; it does not change where TeX Live installs or updates its own packages.
Add files to the user tree
TeX Live’s tlmgr user mode is not supported on Windows, so commands such as tlmgr init-usertree and tlmgr --usermode install packagename cannot be used to install packages in TEXMFHOME. To install a package provided by TeX Live, use the normal system-wide tlmgr install packagename command, with an account that has the permissions required by that TeX Live installation. Such packages are installed in TeX Live’s managed tree, not in TEXMFHOME.
The user tree is where you can put files that you maintain yourself. For example, a LaTeX package file can go in:
D:\TeX\texmf\tex\latex\mypackage\mypackage.sty
Create the folders if needed. Other file types have their own conventional subdirectories; for example, BibTeX style files normally belong under bibtex\bst. Keeping this structure lets TeX Live search files by type.
Confirm TeX Live is using the folder
In a new command prompt, check the value TeX Live reports for TEXMFHOME:
kpsewhich -var-value=TEXMFHOME
It should print the custom folder. To check whether a particular package file is found, run:
kpsewhich mypackage.sty
If the file is found, the command prints its location. If it prints nothing, check the file name, directory structure, and whether the application was restarted after changing the environment variable. For manually added files, running mktexlsr may help if TeX Live is using a filename database for that tree.
If you want to move the whole TeX Live installation
TEXMFHOME is for personal files, not for relocating TeX Live itself. The managed installation tree contains files and configuration that tlmgr expects at their installed locations. Moving that tree in File Explorer can leave package records, scripts, or paths inconsistent. Install TeX Live again with the Windows installer and choose the new installation root; then reinstall packages or migrate only your personal files into the new user tree.
Also distinguish the package repository from the package installation directory. A repository is the source from which tlmgr downloads packages; changing it does not move the installed files.
Common mistakes
- Changing the repository instead of the destination:
tlmgrrepository settings choose where packages are downloaded from, not where they are installed. - Editing
texmf-distdirectly: TeX Live manages this tree, and updates can overwrite manual changes. Put personal files inTEXMFHOMEinstead. - Using a folder without TeX’s expected structure: A
.styfile placed directly in the root of the user tree may not be found. Use a path such astex\latex\packagename\. - Testing in an old application window: Windows environment changes are inherited when applications start. Restart the editor or command prompt before checking the new value.
References
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.