Wine

Wine is a compatibility layer capable of running Microsoft Windows applications on Unix-like operating systems. Programs running in Wine act as native programs would, without the performance/memory penalties of an emulator.

Consider installing wine_gecko and wine-mono for applications that depend on Internet Explorer and .NET, respectively. These packages are not strictly required as Wine will download the relevant files as needed. However, having the files downloaded in advance allows you to work off-line and makes it so Wine does not download the files for each Wine prefix needing them.

Configuration

Configuring Wine is typically accomplished using:

winecfg is a GUI configuration tool for Wine, which can be started by running winecfg.

WINEPREFIX

By default, Wine stores its configuration files and installed Windows programs in ~/.wine. This directory is commonly called a "Wine prefix" or "Wine bottle". It is created/updated automatically whenever you run a Windows program or one of Wine's bundled programs such as winecfg. The prefix directory also contains a tree which your Windows programs will see as C: (the C-drive).

You can override the location Wine uses for a prefix with the WINEPREFIX environment variable. This is useful if you want to use separate configurations for different Windows programs. The first time a program is run with a new Wine prefix, Wine will automatically create a directory with a bare C-drive and registry.

For example, if you run one program with $ env WINEPREFIX=~/.win-a wine program-a.exe, and another with $ env WINEPREFIX=~/.win-b wine program-b.exe, the two programs will each have a separate C-drive and separate registries.

Note: Wine prefixes are not sandboxes! Programs running under Wine can still access the rest of the system! (for example, Z: is mapped to /, regardless of the Wine prefix).

To create a default prefix without running a Windows program or other GUI tool you can use:

$ env WINEPREFIX=~/.customprefix wineboot -u

WINEARCH

Wine will start an 64-bit environment by default. You can change this behavior using the WINEARCH environment variable. Rename your ~/.wine directory and create a new Wine environment by running $ WINEARCH=win32 winecfg. This will get you a 32-bit Wine environment. Not setting WINEARCH will get you a 64-bit one.

You can combine this with WINEPREFIX to make a separate win32 and win64 environment:

If you want to use the OSS driver in Wine, you will need to install the lib32-alsa-oss package. The OSS driver in the kernel will not suffice.

Games that use advanced sound systems (e.g. TESV: Skyrim) may additionally require installations of lib32-openal.

If winecfgstill fails to detect the audio driver (Selected driver: (none)), configure it via the registry. For example, in a case where the microphone wasn't working in a 32-bit Windows application on a 64-bit stock install of wine-1.9.7, this provided full access to the sound hardware (sound playback and mic): open regedit, look for the key HKEY_CURRENT_USER → Software → Wine → Drivers, and add a string called Audio and give it the value alsa. Also, it may help to recreate the prefix.

MIDI support

MIDI was a quite popular system for video games music in the 90's. If you are trying out old games, it is not uncommon that the music will not play out of the box.
Wine has excellent MIDI support. However you first need to make it work on your host system, as explained in MIDI. Last but not least you need to make sure Wine will use the correct MIDI output.

Other libraries

Some applications (e.g. Office 2003/2007) require the MSXML library to parse HTML or XML, in such cases you need to install lib32-libxml2.

Fonts

If Wine applications are not showing easily readable fonts, you may not have any fonts installed. To easily link all of the system fonts so they are accessible from wine:

cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts && for i in /usr/share/fonts/**/*.{ttf,otf}; do ln -s "$i" ; done

Another possibility is to install Microsoft's Truetype fonts into your wine prefix. See MS Fonts. If this does not help, try running winetricks corefonts first, then winetricks allfonts as a last resort.

After running such programs, kill all Wine servers and run winecfg. Fonts should be legible now.

If the fonts look somehow smeared, import the following text file into the Wine registry with regedit:

Note: Wine does not support installing Windows applications for all users, so it will not put .desktop files in /usr/share/applications. See WineHQ bug 11112

Tip: If menu items were not created while installing software or have been lost, wine winemenubuilder may be of some use.

Creating menu entries for Wine utilities

By default, installation of Wine does not create desktop menus/icons for the software which comes with Wine (e.g. for winecfg, winebrowser, etc). These instructions will add entries for these applications.

First, install a Windows program using Wine to create the base menu. After the base menu is created, you can create the following files in ~/.local/share/applications/wine/:

If these settings produce a ugly/non-existent icon, it means that there are no icons for these launchers in the icon set that you have enabled. You should replace the icon settings with the explicit location of the icon that you want. Clicking the icon in the launcher's properties menu will have the same effect. A great icon set that supports these shortcuts is GNOME-colors.

Removing menu entries

Menu entries created by Wine are located in ~/.local/share/applications/wine/Programs/. Remove the program's .desktop entry to remove the application from the menu.

In addition to remove unwanted extensions binding by Wine, execute the following commands (taken from the Wine website):

Mono and Gecko

when initializing a new wineprefix wine will ask to install mono and gecko. or if the packages wine-mono and wine_gecko are installed wine will silently copy about 450 mb of mono and gecko files in the wineprefix.

to prevent wine from asking to install mono and gecko start wine like this:

WINEDLLOVERRIDES=mscoree=d;mshtml=d wine somewineapp

Printing

In order to use your installed printers (both local and network) with wine applications in win32 prefixes (e.g. MS Word), install the lib32-libcups package, reboot wine (wineboot) and restart your wine application.

Usage

Warning: Do not run or install Wine applications as root! See Wine FAQ for details.

Tips and tricks

Wineconsole

Often you may need to run .exe's to patch game files, for example a widescreen mod for an old game, and running the .exe normally through Wine might yield nothing happening. In this case, you can open a terminal and run the following command:

$ wineconsole cmd

Then navigate to the directory and run the .exe file from there.

Winetricks

Winetricks is a script to allow one to install base requirements needed to run Windows programs. Installable components include DirectX 9.x, MSXML (required by Microsoft Office 2007 and Internet Explorer), Visual Runtime libraries and many more.

CSMT

Since 2013 Wine developers have been experimenting with stream/worker thread optimizations. You may experience an enormous performance improvement by using this experimental tweak. Many games may run as fast as on Windows or even faster. This Wine tweak is known as CSMT and works with NVidia and AMD graphics cards.

CSMT support needs to be enabled manually. For vanilla wine run wine regedit and set the DWORD value for Software > Wine > Direct3D > csmt to 0x01 (enabled). For wine-staging run winecfg and enable it in the staging tab.

Unregister existing Wine file associations

By default, Wine takes over as the default application for a lot of formats. Some (e.g. vbs or chm) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. gif, jpeg, txt, js) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.

Wine's file associations are set in ~/.local/share/applications/ as wine-extension-extension.desktop files. Delete the files corresponding to the extensions you want to unregister. Or, to remove all wine extensions:

This has to be done for each WINEPREFIX which should not update file associations.

You can disable winemenubuilder for all WINEPREFIXes by setting an environment variable:

$ export WINEDLLOVERRIDES="winemenubuilder.exe=d"

Execute Windows binaries with wine implicitly

The wine package installs a binfmt file which will allow you to run Windows programs directly (e.g. ./myprogram.exe will launch as if you had typed wine ./myprogram.exe). All you have to do in order to use this is to start the systemd-binfmt service after installing the wine package.

Dual Head with different resolutions

If you have issues with dual-head setups and different display resolutions you are probably missing lib32-libxrandr.

Changing the language

Some programs may not offer a language selection, they will guess the desired language upon the system locales. Wine will transfer the current environment (including the locales) to the application, so it should work out of the box. If you want to force a program to run in a specific locale (which is fully generated on your system), you can call Wine with the following setting:

$ LC_ALL=xx_XX.encoding wine /path/to/program

For instance

$ LC_ALL=it_IT.UTF-8 wine /path/to/program

Using Wine as an interpreter for Win16/Win32 binaries

It is also possible to tell the kernel to use Wine as an interpreter for all Win16/Win32 binaries:

Burning optical media

Proper mounting of optical media images

Some applications will check for the optical media to be in drive. They may check for data only, in which case it might be enough to configure the corresponding path as being a CD-ROM drive in winecfg.
However, other applications will look for a media name and/or a serial number, in which case the image has to be mounted with these special properties.

Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). CDEmu will handle it correctly.

Force OpenGL mode in games

Many games have an OpenGL mode which may perform better than their default DirectX mode. While the steps to enable OpenGL rendering is application specific, many games accept the -opengl parameter.

$ wine /path/to/3d_game.exe -opengl

You should of course refer to your application's documentation and Wine's AppDB for such application specific information.

Show FPS overlay in games

Wine features an embedded FPS monitor which works for all graphical applications if the environment variable WINEDEBUG=fps is set. This will output the framerate to stdout. You can display the FPS on top of the window thanks to osd_cat from the xosd package. See winefps.sh for a helper script.

In order to not be asked for a password each time Wine is run as another user the following entry can be added to the sudoers file: mainuser ALL=(wineuser) NOPASSWD: ALL. See Sudo#Configuration for more information.

It is recommended to run winecfg as the Wine user and remove all bindings for directories outside the home directory of the Wine user in the "Desktop Integration" section of the configuration window so no program run with Wine has read access to any file outside the special user's home directory.