Red Wine in a GlassHow to Install Windows Apps on Linux using WineCSS HTML Validator Logo
HOME Tutorials & Essays About
Tutorials & Essays About

March 12, 2024

Installing Windows Apps on Linux
How to do it with Wine

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

Major Wine commands

Please refer to the Wine User's GuideNew Window Icon 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.

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 CommandsNew Window Icon. In my experience, not all of the listed commands have been implemented.


Facebook Logo   Twitter Logo   Reddit Logo   Quora Logo

Consider sharing your experience

Did you find this page helpful? Have constructive feedback? Wisdom to share?

Send email to Email Address

Privacy PolicyNew Window Icon

Graphic image of Athena pouring wine for Heracles, from 470 BC