How to create new Wine prefixes on Linux
A Wine prefix (AKA a Wine bottle) is a special folder in which Wine places all Wine-specific files, installed Windows programs, libraries and registry code, and even user preferences in.
Usually, a user only has one Wine prefix. This prefix is the ~/.wine folder. Typically, it’s set to run in Windows XP mode (or later versions of Windows as well), and often Linux users don’t ever tinker with this folder or modify it in any way, due to the maturity and reliability of the Wine tool.
Though the average Linux user can get by with just using the default Wine prefix, it’s highly beneficial to make multiple ones, as they can be tuned to run specific versions of Windows, house different types of software that doesn’t work in the default prefix folder, etc.
Note: following this guide requires Wine. Before continuing, follow our tutorial on how to install the Wine software on Linux.
Create 32-bit Wine prefix
For some Windows programs to work correctly in Wine, a 32-bit prefix is necessary. Unfortunately, the default Wine system doesn’t set this up by default when the user runs Wine for the first time.
Making a new 32-bit Wine prefix starts by launching a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T. Then, use the WINEPREFIX command in the terminal window, followed by the location where you’d like to store the new prefix.
Note: be sure to change the username in the command below with your Linux PC’s username.
Winearch=win32 WINEPREFIX="/home/username/.newprefix32/" winecfg
As the above command runs, it’ll create a new folder in your current user’s home folder (~) labeled “.newprefix32.” If you dislike this name, feel free to change the name of the directory before running it.
When the WINEPREFIX command finishes executing, you may see several GUI prompts appear. In these prompts, you’ll be asked to install things for the software to run. Follow the GUI prompts and ensure everything is installed.
After taking care of the tools Wine needs to install, the WineCFG tool will open. Use this tool to customize your new Wine prefix and set things such as the Windows version, graphics, etc.
Create 64-bit Wine prefix
By default, when you run the Wine software (on a 64-bit Linux operating system) for the first time, it’ll create a standard 64-bit Wine prefix in ~/.wine in home directory (~).
Usually, using the default 64-bit ~/.wine prefix folder is fine for most users. However, if you’re running specialized software that requires a lot of tweaks, it’s still a good idea to learn how to create separate 64-bit Wine prefixes.
To make a new 64-bit Wine prefix, launch a terminal window and use the WINEPREFIX command like in the 32-bit example. However, this time, don’t use Winearch, as it’s not necessary to set up this one.
Note: be sure to change the username in the command below to the username on your Linux PC.
WINEPREFIX="/home/username/.newprefix/" winecfg
In the above command example, we set the new 64-bit Wine prefix in a folder labeled “newprefix.” This name is just for demonstration purposes. If you dislike this name, feel free to swap it out with another name that more suits your use-case.
After entering the WINEPREFIX command above, the Wine tool will set up a new prefix folder in the home directory (~) of your current user. During that creation process, you may see some GUI windows pop up. Follow the GUI prompts and do what they say to ensure that everything is set up correctly.
Once the GUI prompts are dealt with, the WineCFG window will appear. Use this window to configure your new 64-bit Wine prefix, change Windows versions, graphics settings, etc.
Delete Wine prefixes
Done using a Wine prefix and want to get rid of it? Here’s what to do. First, open up a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T. Then, use the ls command with the “a” command-line switch to reveal all of the files and folders in your home directory.
ls -a
Look through the list of files for the name of your Wine prefix folder. Then, use the rm command with the “rf” command-line switch to delete the prefix folder.
rm -rf ~/.newprefix/
Or:
rm -rf ~/.newprefix32/
Need to get rid of multiple prefix folders at once? Make use of brackets when using the rm command. For example, to delete two prefix folders, you’d do:
rm -rf ~/{.newprefix,.newprefix32}
For four folders, try:
rm -rf ~/{.newprefix1,.newprefix2,.newprefix3,newprefix4}
There’s no limit to how many prefixes can be removed at once with the rm command, list out the folder names in brackets followed by “,” and it’ll work.
How to set wineprefix without gui prompt at the end.
In the article “WINEPREFIX” is referred to as a command a few times, it’s not the command it’s an environment variable (just like “WINEARCH”). The command is in fact the “winecfg” portion of the line. If you want to set environment variables (when running a command), one or more environment variables can be placed before the command with the desired value(s).
IE:
> ENV_VAR_1=value ENV_VAR_2=value command_to_run –option parameter
In the very first part of your article,
Winearch=win32
should be: WINEARCH=win32