March 12, 2024
Introduction
This document explains Wine Prefixes and how to use them when installing Windows apps on Linux. Each different Wine Prefix identifies a different Windows environment. You can have a different Windows app in each environment, and the environments can be different: Win 11, Win 10, Win 8.1, or Win 7. You can also have several apps in the same Windows Prefix, which saves some disk space but does not provide the safety of separate apps in separate environments.
Using Wine Prefixes is optional. If you follow the directions in this document but ignore every export command, all Windows apps will be installed in the default prefix, which is .wine. If you have only one Windows app to install, this is fine. It is also fine if there are several Windows apps, and they can all run in the same Windows environment. The reason to use Wine Prefixes is to have different environments for different apps or to keep apps in separate environments so that something going wrong with one app will not affect others.
The complication of having more than one Wine Prefix is that one must be careful to always give Wine advance notice of which prefix a Wine command is to act on. Say you have two apps, "App1" and "App2" and they are in prefixes .wine-app1 and .wine-app2. If you issue the terminal command
$ export WINEPREFIX=~/.wine-app1
all subsequent Wine commands will act on the prefix .wine-app1. To do something with .wine-app2, change the value assigned to WINEPREFIX with
$ export WINEPREFIX=~/.wine-app2
Continue reading to learn how to install Windows apps in Linux, either with or without Wine Prefixes.
Enable "Show Hidden Files"
Before proceeding, you may want to enable the Show Hidden Files option in your file browser (Nautilus or other). If you follow the recommendation of creating a Wine prefix with a name that starts with a period, like ~/.wine-SomeWinApp, or if you accept the default Wine prefix, which is ~/.wine, that folder will be hidden and therefore invisible unless Show Hidden Files is enabled. This will be important when you need to access the contents of the Wine prefix folder.
Installing windows apps
Open a Terminal window.
The next two commands do initial setup in advance of creating a Wine prefix. The name given here to the prefix is ".wine-SomeWinApp", which would be appropriate if the name of the hypothetical Windows application is "SomeWinApp", perhaps with installation file "SomeWinApp.exe" or "SomeWinApp.msi".
$ mkdir -v ~/.wine-SomeWinApp
$ export WINEPREFIX=~/.wine-SomeWinApp
It is the next command, wine winecfg, that actually creates the Wine prefix by loading folder ~/.wine-SomeWinApp with the magic that allows it to host running Windows apps. Be aware that winecfg generates lots of error messages, which you should simply ignore.
While winecfg is running, it may offer to install one or both of mono and geko. In that case, allow winecfg to do the downloads and installations. In fact, geko may ask to be downloaded and installed a second time. When this happens, it is probably because both Gecko 32-bit and Gecko 64-bit are needed, so allowing both to proceed is recommended.
When a dialog window opens and asks you to choose a Windows Version, the choice of Windows 10 usually works, though older applications may need another selection. Other options in this dialog can be the defaults.
Eventually, winecfg will finish (messages from winecfg cease), but there may be no $ Terminal prompt. In that case, press the Enter key to display a Terminal prompt.
OK – go ahead and tell Wine to execute winecfg.
$ wine winecfg
At this point, the Wine prefix is prepared to host Windows applications, so the next step is to do the installation. How installation is done depends on whether the installation file is an .exe or an .msi. For an .exe file located in the Downloads folder, do the following to cd to ~/Downloads and install.
$ cd ~/Downloads
$ wine SomeWinApp.exe
For an .msi file, do either
$ cd ~/Downloads
$ wine msiexec /i SomeWinApp.msi # /i is the "install" option
or
$ cd ~/Downloads
$ wine start SomeWinApp.msi
As the installer does its job, expect to respond to the usual prompts, such as accepting the license, choosing a language, allowing a launcher to be installed, etc. When complete, the Windows application, if it does not make use of any Windows feature not yet supported by Wine, can be expected to behave just as if it were running on a Windows PC, though it is not uncommon to find that some accommodations or work-arounds may be required. If a launcher was installed, it may be found on the desktop or included among the other installed Linux Applications.
Uninstalling installed apps
Open a Terminal session and issue the following.
$ export WINEPREFIX=~/.wine-SomeWinApp
$ wine uninstaller
In the above, the first command, export, informs Wine which Wine prefix the uninstall command is to act on. If only the default prefix, .wine, has been configured, the export is unnecessary. Of course, "~/.wine-SomeWinAPP" is to be replaced by your own Wine prefix.
The second command causes Wine's Add/Remove Programs app to open in a window. The Add/Remove Programs window will list the apps installed in the Wine prefix. Click the app you wish to uninstall, and then click the "Remove" button. System apps, such as Wine Gecko, can be ignored.
In my experience, what happens next may be confusing or concerning. You may see a clear uninstall process run to completion, but, more often, the process appears to be an installation or something else unexpected. However, in spite of the confusing messaging, the target app was always uninstalled.
After the uninstallation, icons may be left on the desktop or elsewhere, including the list of all installed apps. Clicking on the icon may provoke a "file not found" message, upon which the icon disappears. Some icons can simply be deleted. Rebooting the system may also help with icon cleanup.
If the Wine prefix held only a single app, you may want to delete the Wine prefix, which will release the disk space it occupied, as well as being tidy. This can be done either through your distribution's Files graphical interface or with a Terminal command.
$ rm -r ~/.wine-SomeWinApp
Other uses of Wine's Add/Remove Programs app
As the name "Add/Remove Programs" suggests, you can also use
$ export WINEPREFIX=~/.wine-SomeWinApp
$ wine uninstaller
to install an app in a Wine prefix. When the Add/Remove Programs window opens, look for the "Install" button. I have never tried this.
This also a way to list all apps installed in a given Wine prefix.
Important to know and remember
- If you use a custom Wine prefix, such as ~/.wine-SomeWinApp, before using the wine command or any related command, the WINEPREFIX environment variable must be exported, otherwise Wine will not know to act on the intended Wine prefix. Once WINEPREFIX is defined, its value remains in effect until changed by exporting a new value.
- The above does not apply if you did not define a custom Wine prefix. In that case, Wine will use the default prefix "~/.wine".
- The above also does not apply when using an automatically installed launcher. The launcher sets up the appropriate Wine prefix before launching the application.
- It is recommended to install using an .exe file rather than an .msi file, unless no .exe is available.
- All of these three installation commands are preceded by cd to the folder holding the installation file. This is always safe, but, when using the wine command with an .exe file, it is mandatory. To skip the cd and specify the full path to the installation file, use the wine start command.
- Absent a launcher, or instead of using a launcher, use the wine command or the wine start command with the program executable. If using a custom Wine prefix, precede the command by exporting the WINEPREFIX environment variable, unless it is already defined. If including a path to the executable, use the wine start command.
- The wine start command can also be applied to a document that opens by default with an installed Windows application. As always, ensure the appropriate value for WINEPREFIX has been exported before issuing the wine start command.
Major Wine commands
Please refer to the Wine User's Guide for authoritative explanations and further information. There is also a Wine man page which is accessed from the Terminal in the usual way.
$ man wine
Here are the most immediately useful Wine commands.
- wine --version
Display current Wine version, verifies Wine is installed - export WINEPREFIX=.~/.wine-SomeWinApp
Export a Wine prefix - wine winecfg
Initialize and configure a newly created Wine prefix, or make a change in the configuration of a previously configured Wine prefix - wine SomeWinApp.exe [arguments]
Execute a Windows .exe, either an installer or an installed application; must not include a path to the application - wine start SomeWinApp.exe [arguments]
Same as above but may include a path to the application - wine msiexec /i SomeWinApp.msi
Install a Windows app from its .msi - wine start SomeWinApp.msi
Same as above - wine uninstaller
Run the Wine uninstaller in order to uninstall an app - wine control
Opens Wine's Windows Control Panel - wine wineboot
"reboots" (restarts) Wine, for when Windows apps call for a real reboot. The following options provide alternate functionalities. See wiki.winehq.org/Wineboot.
- -h, --help Display this help message
- -e, --end-session End the current session cleanly
- -f,--force Force exit for processes that don't exit cleanly
- -i,--init Perform initialization for first Wine instance
- -k,--kill Kill running processes without any cleanup
- -r,--restart Restart only, don't do normal startup operations
- -s,--shutdown Shutdown only, don't reboot
- -u,--update Update the wineprefix directory
The following are other Wine commands documented in the Wine HQ Wiki. If you read the text on that page carefully, you will see that, since Wine version 1.1.16, all these commands must begin with wine.
For the complete command list, please refer to Wine HQ Wiki's List of Commands. In my experience, not all of the listed commands have been implemented.
- wine clock A simple analog clock
- wine cmd Command prompt window
- wine explorer File Explorer implimentation
- wine iexplore Wine Internet Explorer
- wine notepad A simple GUI text editor
- wine regedit Registry editor
- wine taskmgr A task manager
- wine winemine Classic minesweeper
- wine wordpad Wine Wordpad
- wine xcopy Wine-compatible xcopy
Consider sharing your experience
Did you find this page helpful? Have constructive feedback? Wisdom to share?
Send email to Email Address
Privacy Policy