Changing the location of auto-installed packages in MiKTeX
As Ulrike explained in the comments above, it seems that MikTeX allows the UserInstall
directory to be configured only during installation. So, it's easiest to just re-install it, calling the installer from the commandline with suitable options. The full set of commandline options for the installer is documented here.
I first removed the existing MikTeX by running the uninstaller from the Start menu. I then opened a command prompt (this is on Windows), switched to the directory containing the downloaded installer, and ran the following:
C:\...> basic-miktex-***.exe --shared --user-install="C:\Path\to\my\root"
I used --shared
since it's being installed for all users, but I was asked again during the set-up dialog anyway. There are also options --user-config
and --user-data
(I don't mind leaving those in the default location).
I am just setting up a new computer, so this was a no-brainer. I follow best practices and keep all style files that are not managed by MikTeX in a separate texmf hierarchy, so there was no need to salvage anything before uninstalling. But if you have been dropping your non-CTAN styles into the MikTeX texmf tree (definitely not a good idea), or have a huge texmf tree and a slow internet connection, or use your computer off-line a lot and don't want to be surprised by missing packages, you can follow this procedure, which lets you use your old texmf
tree as the data source for the new installation (thanks @Speravir for the pointer).