Difference between revisions of "Wine"

From ArchWiki
Jump to navigation Jump to search
(→‎Unregister Wine file associations: Fix instructions so that it actually removes the association files and update-desktop-database won't affect it)
 
(259 intermediate revisions by 62 users not shown)
Line 1: Line 1:
[[Category:Wine]]
+
[[Category:Emulation]]
 +
[[Category:Gaming]]
 
[[cs:Wine]]
 
[[cs:Wine]]
 
[[de:Wine]]
 
[[de:Wine]]
Line 7: Line 8:
 
[[ja:Wine]]
 
[[ja:Wine]]
 
[[ru:Wine]]
 
[[ru:Wine]]
[[zh-CN:Wine]]
+
[[zh-hans:Wine]]
[[zh-TW:Wine]]
+
[[zh-hant:Wine]]
 
{{Related articles start}}
 
{{Related articles start}}
{{Related|Steam/Wine}}
 
 
{{Related|CrossOver}}
 
{{Related|CrossOver}}
 +
{{Related|Wine package guidelines}}
 
{{Related articles end}}
 
{{Related articles end}}
[[Wikipedia:Wine (software)|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. See the [http://www.winehq.org/ official project home] and [http://wiki.winehq.org/ wiki] pages for longer introduction.
+
[[Wikipedia:Wine (software)|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.
 +
 
 +
{{Warning|If you can access a file or resource with your user account, programs running in Wine can too. See [[#Running Wine under a separate user account]] and [[Security#Sandboxing applications]] for possible precautions.}}
  
 
== Installation ==
 
== Installation ==
{{Warning|If you can access a file or resource with your user account, programs running in Wine can too. Wine prefixes are '''not''' [[wikipedia:Sandbox (computer security)|sandboxes]]. Consider using [[wikipedia:Virtualization|virtualization]] if security is important.}}
 
  
Wine can be [[pacman|installed]] with the package {{Pkg|wine}}, available in the [[official repositories]]. If you are running a 64-bit system, you will need to enable the [[Multilib]] repository first.
+
Wine can be installed by enabling the [[multilib]] repository and [[install]]ing the {{Pkg|wine}} (stable) or {{Pkg|wine-staging}} (testing) package. [https://wine-staging.com/ Wine Staging] is a patched version of [https://www.winehq.org/ Wine], which contains bug fixes and features that have not been integrated into the stable branch yet. See also [[#Graphics drivers]] and [[#Sound]].
  
You may also want to install {{pkg|wine_gecko}} and {{pkg|wine-mono}} for applications that need support for 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.
+
Consider installing {{pkg|wine_gecko}} and {{pkg|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.
  
'''Architectural differences'''
+
=== Third-party applications ===
  
Wine by default is 32-bit, as is the i686 Arch package. As such, it is unable to execute any 64-bit Windows applications.
+
These have their own communities and websites, and are '''not supported''' by greater Wine community. See [https://wiki.winehq.org/Third_Party_Applications Wine Wiki] for more details.
  
The x86_64 Arch package, however, is built with {{ic|--enable-win64}}. This activates the Wine version of [[Wikipedia:WoW64|WoW64]].
+
* {{App|[[CrossOver]]|Paid, commercialized version of Wine which provides more comprehensive end-user support.|https://www.codeweavers.com|{{AUR|crossover}}}}
*In Windows, this complicated subsystem allows the user to use 32-bit and 64-bit Windows programs concurrently and even in the same directory.
+
* {{App|exe-thumbnailer|Generates thumbnails for Windows executable files (.exe, .lnk, .msi, and .dll).|https://github.com/exe-thumbnailer/exe-thumbnailer|{{AUR|exe-thumbnailer}}}}
*In Wine, the user will have to make separate directories/prefixes. See [http://wiki.winehq.org/Wine64 Wine64] for specific information on this.
+
* {{App|[[Wikipedia:Lutris|Lutris]]|Gaming launcher for all types of games, including Wine games (with prefix management), native Linux games and emulators.|https://lutris.net|{{Pkg|lutris}}}}
 
+
* {{App|[[Wikipedia:PlayOnLinux|PlayOnLinux]]|Graphical prefix manager for Wine. Contains scripts to assist with program installation and configuration.|https://www.playonlinux.com|{{Pkg|playonlinux}}}}
If you run into problems with {{ic|winetricks}} or programs with a 64-bit environment, try creating a new 32-bit {{ic|WINEPREFIX}}. See below: [[#WINEARCH]]. Using the x86_64 Wine package with {{ic|1=WINEARCH=win32}} should have the same behaviour as using the i686 Wine package.
+
* {{App|Proton|Compatibility tool made for [[Steam]] based on Wine and additional components. See [https://www.protondb.com/ ProtonDB] for compatibility list.|https://github.com/ValveSoftware/Proton|{{AUR|proton}}}}
 +
* {{App|PyWinery|Simple graphical prefix manager for Wine.|https://github.com/ergoithz/pywinery|{{AUR|pywinery}}}}
 +
* {{App|Q4Wine|Graphical prefix manager for Wine. Can export [[Qt]] themes into the Wine configuration for better integration.|https://sourceforge.net/projects/q4wine/|{{AUR|q4wine}}}}
  
 
== Configuration ==
 
== Configuration ==
 
Configuring Wine is typically accomplished using:
 
Configuring Wine is typically accomplished using:
* [http://wiki.winehq.org/winecfg winecfg] is a GUI configuration tool for Wine. You can run it from a console window with: {{ic|$ winecfg}}, or {{ic|1=$ WINEPREFIX=~/.some_prefix winecfg}}.
+
* [https://wiki.winehq.org/Winecfg winecfg] is a GUI configuration tool for Wine, which can be started by running {{ic|winecfg}}.
* [http://wiki.winehq.org/control control.exe] is Wine's implementation of Windows' Control Panel which can be accessed with: {{ic|$ wine control}}.
+
* [https://wiki.winehq.org/Regedit regedit] is Wine's registry editing tool,  which can be started by running {{ic|regedit}}. See WineHQ's article on [https://wiki.winehq.org/Useful_Registry_Keys Useful Registry Keys].
* [http://wiki.winehq.org/regedit regedit] is Wine's registry editing tool. If ''winecfg'' and the Control Panel were not enough, see [http://wiki.winehq.org/UsefulRegistryKeys WineHQ's article on Useful Registry Keys].
+
* [https://wiki.winehq.org/Control control] is Wine's implementation of the Windows Control Panel, which can be started by running {{ic|wine control}}.
 +
* See WineHQ's [https://wiki.winehq.org/List_of_Commands List of Commands] for the full list.
  
 
=== WINEPREFIX ===
 
=== WINEPREFIX ===
 
By default, Wine stores its configuration files and installed Windows programs in {{ic|~/.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 {{ic|C:}} (the C-drive).
 
By default, Wine stores its configuration files and installed Windows programs in {{ic|~/.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 {{ic|C:}} (the C-drive).
  
You can override the location Wine uses for a prefix with the {{ic|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.
+
You can override the location Wine uses for a prefix with the {{ic|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 {{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}, and another with {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}, the two programs will each have a separate C-drive and separate registries.
 
For example, if you run one program with {{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}, and another with {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}, the two programs will each have a separate C-drive and separate registries.
Line 52: Line 57:
 
=== WINEARCH ===
 
=== WINEARCH ===
  
If you have a 64-bit system, Wine will start an 64-bit environment by default. You can change this behavior using the {{ic|WINEARCH}} environment variable. Rename your {{ic|~/.wine}} directory and create a new Wine environment by running {{ic|1=$ WINEARCH=win32 winecfg}}. This will get you a 32-bit Wine environment. Not setting {{ic|WINEARCH}} will get you a 64-bit one.
+
Wine will start an 64-bit environment by default. You can change this behavior using the {{ic|WINEARCH}} [[environment variable]]. Rename your {{ic|~/.wine}} directory and create a new Wine environment by running {{ic|1=$ WINEARCH=win32 winecfg}}. This will get you a 32-bit Wine environment. Not setting {{ic|WINEARCH}} will get you a 64-bit one.
  
 
You can combine this with {{ic|WINEPREFIX}} to make a separate {{ic|win32}} and {{ic|win64}} environment:
 
You can combine this with {{ic|WINEPREFIX}} to make a separate {{ic|win32}} and {{ic|win64}} environment:
Line 58: Line 63:
 
  $ WINEARCH=win32 WINEPREFIX=~/win32 winecfg
 
  $ WINEARCH=win32 WINEPREFIX=~/win32 winecfg
 
  $ WINEPREFIX=~/win64 winecfg
 
  $ WINEPREFIX=~/win64 winecfg
 
{{Note|During prefix creation, the 64-bit version of Wine treats all folders as 64-bit prefixes and will not create a 32-bit in any existing folder. To create a 32-bit prefix you have to let Wine create the folder specified in {{ic|WINEPREFIX}}.}}
 
  
 
You can also use {{ic|WINEARCH}} in combination with other Wine programs, such as ''winetricks'' (using Steam as an example):
 
You can also use {{ic|WINEARCH}} in combination with other Wine programs, such as ''winetricks'' (using Steam as an example):
  
 
  WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam
 
  WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam
 
To have them permanently defined for [[Bash#Shell and environment variables|bash configuration ~/.bashrc]] do:
 
 
export WINEPREFIX=$HOME/.config/wine/
 
export WINEARCH=win32
 
  
 
=== Graphics drivers ===
 
=== Graphics drivers ===
  
For most games, Wine requires high performance accelerated graphics drivers. This likely means using proprietary [[NVIDIA]] or [[AMD Catalyst]] drivers, although the open source [[ATI]] driver is increasingly become proficient for use with Wine. [[Intel]] drivers should mostly work as well as they are going to out of the box.
+
You need to install the 32-bit version of your graphics driver. Please install the package that is listed in the ''OpenGL (multilib)'' column in the table in [[Xorg#Driver installation]].
 
 
See [http://www.phoronix.com/scan.php?page=news_item&px=MTI5NjU Gaming On Wine: The Good & Bad Graphics Drivers] for more details.
 
  
 
A good sign that your drivers are inadequate or not properly configured is when Wine reports the following in your terminal window:
 
A good sign that your drivers are inadequate or not properly configured is when Wine reports the following in your terminal window:
 
  Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly
 
  Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly
 
For 64-bit systems, additional [[multilib]] packages are required. Please install the one that is listed in the ''Multilib Package'' column in the table in [[Xorg#Driver installation]].
 
  
 
{{Note|You might need to restart X after having installed the correct library.}}
 
{{Note|You might need to restart X after having installed the correct library.}}
Line 85: Line 79:
 
=== Sound ===
 
=== Sound ===
  
By default sound issues may arise when running Wine applications. Ensure only one sound device is selected in ''winecfg''. Currently, the [[Alsa]] driver is the most supported.
+
By default sound issues may arise when running Wine applications. Ensure only one sound device is selected in ''winecfg''.
  
If you want to use [[Alsa]] driver in Wine on a 64-bit system, you will need to install {{Pkg|lib32-alsa-lib}} and {{Pkg|lib32-alsa-plugins}}. If you are also using [[PulseAudio]], you will need to install {{Pkg|lib32-libpulse}}.
+
* If you want to use the [[ALSA]] driver in Wine, you will need to install {{Pkg|lib32-alsa-lib}} and {{Pkg|lib32-alsa-plugins}}.
 +
* If you want to use the [[PulseAudio]] driver in Wine, you will need to install the {{Pkg|lib32-libpulse}} package.
 +
* If you want to use the [[OSS]] driver in Wine, you will need to install the {{Pkg|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 {{Pkg|lib32-openal}}.
  
If you want to use [[OSS]] driver in Wine, you will need to install the {{Pkg|lib32-alsa-oss}} package. The OSS driver in the kernel will not suffice.
+
If ''winecfg'' '''still''' fails to detect the audio driver (Selected driver: (none)), [https://www.winehq.org/docs/wineusr-guide/using-regedit#Configuring_Sound configure it via the registry]. For example, in a case where the microphone was not 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 [[#WINEARCH|recreate the prefix]].  
 
 
If ''winecfg'' '''still''' fails to detect the audio driver (Selected driver: (none)), [http://wine-wiki.org/index.php/Wine_Registry#Configuring_Sound configure it via the registry].
 
 
 
Games that use advanced sound systems may require installations of {{Pkg|lib32-openal}}.
 
  
 
==== MIDI support ====
 
==== 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.
 
[[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. See the wiki page for more details. Last but not least you need to make sure Wine will use the correct MIDI output. See the [http://wiki.winehq.org/MIDI Wine Wiki] for a detailed setup.
+
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 ===
 
=== Other libraries ===
Line 111: Line 104:
  
 
*Some applications that require encryption support may require {{Pkg|lib32-gnutls}}.
 
*Some applications that require encryption support may require {{Pkg|lib32-gnutls}}.
 +
 +
*Some applications require 32-bit video codecs or the program crashes. Install {{Pkg|lib32-gst-plugins-base}}, {{Pkg|lib32-gst-plugins-good}}, {{Aur|lib32-gst-plugins-bad}} and {{Aur|lib32-gst-plugins-ugly}}.
  
 
=== Fonts ===
 
=== Fonts ===
  
If Wine applications are not showing easily readable fonts, you may not have Microsoft's Truetype fonts installed. See [[MS Fonts]]. If this does not help, try running {{ic|winetricks allfonts}}.
+
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
 +
 
 +
Wine uses freetype to render fonts, and freetype's defaults changed a few releases ago. Try using this environment setting for wine programs:
 +
 
 +
  FREETYPE_PROPERTIES="truetype:interpreter-version=35"
 +
 
 +
Another possibility is to install Microsoft's Truetype fonts into your wine prefix. See [[MS Fonts]]. If this does not help, try running {{ic|winetricks corefonts}} first, then {{ic|winetricks allfonts}} as a last resort.
  
 
After running such programs, kill all Wine servers and run {{ic|winecfg}}. Fonts should be legible now.
 
After running such programs, kill all Wine servers and run {{ic|winecfg}}. Fonts should be legible now.
  
If the fonts look somehow smeared, import the following text file into the Wine registry with [http://wiki.winehq.org/regedit regedit]:
+
If the fonts look somehow smeared, import the following text file into the Wine registry with [https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit]:
  
 +
Windows Registry Editor Version 5.00
 
  [HKEY_CURRENT_USER\Software\Wine\X11 Driver]
 
  [HKEY_CURRENT_USER\Software\Wine\X11 Driver]
 
  "ClientSideWithRender"="N"
 
  "ClientSideWithRender"="N"
 +
 +
For high resolution displays, you can adjust dpi values in winecfg.
  
 
See also [[Font configuration#Applications without fontconfig support]].
 
See also [[Font configuration#Applications without fontconfig support]].
 +
 +
==== Enable font smoothing ====
 +
A good way to improve wine font rendering is to enable cleartype font smoothing.
 +
To enable "Subpixel smoothing (ClearType) RGB":
 +
 +
{{bc|<nowiki>cat << EOF > /tmp/fontsmoothing
 +
REGEDIT4
 +
 +
[HKEY_CURRENT_USER\Control Panel\Desktop]
 +
"FontSmoothing"="2"
 +
"FontSmoothingOrientation"=dword:00000001
 +
"FontSmoothingType"=dword:00000002
 +
"FontSmoothingGamma"=dword:00000578
 +
EOF
 +
 +
WINE=${WINE:-wine} WINEPREFIX=${WINEPREFIX:-$HOME/.wine} $WINE regedit /tmp/fontsmoothing 2> /dev/null</nowiki>}}
 +
 +
For more information, check [https://askubuntu.com/a/219795/514682 the original answer]
  
 
=== Desktop launcher menus ===
 
=== Desktop launcher menus ===
  
Installing Windows programs in Wine should result in the appropriate menu/desktop icons being created. For example, if the installation program (e.g. ''setup.exe'') would normally add an icon to your Desktop or "Start Menu" on Windows, then Wine should create corresponding freedesktop.org style ''.desktop'' files for launching your programs with Wine.
+
When a Windows application installer creates a shortcut Wine creates a {{ic|.desktop}} file instead. The default locations for those files in Arch Linux are:
 +
* Desktop shortcuts are put in {{ic|~/Desktop}}
 +
* Start menu shortcuts are put in {{ic|~/.local/share/applications/wine/Programs/}}
 +
 
 +
{{Note|1=Wine does not support installing Windows applications for all users, so it will not put {{ic|.desktop}} files in {{ic|/usr/share/applications}}. See WineHQ bug [https://bugs.winehq.org/show_bug.cgi?id=11112 11112]}}
  
{{Tip|If menu items were ''not'' created while installing software or have been lost, [http://wiki.winehq.org/winemenubuilder winemenubuilder] may be of some use.}}
+
{{Tip|If menu items were ''not'' created while installing software or have been lost, {{ic|wine winemenubuilder}} may be of some use.}}
  
 
==== Creating menu entries for Wine utilities ====
 
==== 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.
+
By default, installation of Wine does not create desktop menus/icons for the software which comes with Wine (e.g. for ''winecfg'', ''winebrowser'', etc). This can be achieved by installing {{AUR|wine-installer}} meta-package, otherwise 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 {{ic|~/.local/share/applications/wine/}}:
 
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 {{ic|~/.local/share/applications/wine/}}:
Line 199: Line 227:
 
  $ rm ~/.local/share/mime/application/x-wine-extension*
 
  $ rm ~/.local/share/mime/application/x-wine-extension*
  
==== KDE 4 menu fix ====
+
=== Appearance ===
 +
 
 +
A similar to XP looking theme can be downloaded from [http://download.microsoft.com/download/e/a/9/ea9af5ae-b48e-473e-85fe-dcde7472e644/ZuneDesktopTheme.msi here]. To install it see [https://wiki.winehq.org/Wine_User%27s_Guide#Running_.msi_files here]. Lastly use ''winecfg'' to select it.
 +
Wine staging users may instead want to try enabling the option ''Enable GTK3 Theming'' under the Staging section of ''winecfg'' for a theme that matches the current GTK theme.
  
The Wine menu items [https://bugs.launchpad.net/ubuntu/+source/wine/+bug/263041 may appear] in "Lost & Found" instead of the Wine menu in KDE 4. This is because {{ic|kde-applications.menu}} is missing the {{ic|MergeDir}} option.
+
=== Printing ===
  
Edit {{ic|/etc/xdg/menus/kde-applications.menu}}
+
In order to use your installed printers (both local and network) with wine applications in ''win32 prefixes'' (e.g. MS Word), install the {{Pkg|lib32-libcups}} package, reboot wine (''wineboot'') and restart your wine application.
  
At the end of the file add {{ic|<MergeDir>applications-merged</MergeDir>}} after {{ic|<DefaultMergeDirs/>}}, it should look like this:
+
== Usage ==
<Menu>
 
        <Include>
 
                <And>
 
                        <Category>KDE</Category>
 
                        <Category>Core</Category>
 
                </And>
 
        </Include>
 
        <DefaultMergeDirs/>
 
        '''<MergeDir>applications-merged</MergeDir>'''
 
        <MergeFile>applications-kmenuedit.menu</MergeFile>
 
</Menu>
 
  
Alternatively you can create a symlink to a folder that KDE does see:
+
{{Warning|Do not run or install Wine applications as root! See [https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F Wine FAQ] for details.}}
$ ln -s ~/.config/menus/applications-merged ~/.config/menus/kde-applications-merged
 
  
This has the added bonus that an update to KDE will not change it, but is per user instead of system wide.
+
See [https://wiki.winehq.org/FAQ Wine FAQ] and [https://wiki.winehq.org/Wine_User%27s_Guide Wine User's Guide] for general information on Wine usage.
  
== Running Windows applications ==
+
See [https://appdb.winehq.org/ Wine Application Database (AppDB)] for information on running Windows applications in Wine.
 +
 
 +
== Tips and tricks ==
  
{{Warning|Do not run or install Wine applications as root! See [http://wiki.winehq.org/FAQ#run_as_root Running Wine as root] for the official statement.}}
+
=== Wineconsole ===
To run a Windows application:
 
$ wine ''path_to_exe''
 
  
To install using an MSI installer, use the included ''msiexec'' utility:
+
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:
$ msiexec /i ''path_to_msi''
 
  
== Tips and tricks ==
+
$ wineconsole cmd
 +
 
 +
Then navigate to the directory and run the ''.exe'' file from there.
 +
 
 +
=== Winetricks ===
  
{{Tip|In addition to the links provided in the beginning of the article the following may be of interest:
+
[https://wiki.winehq.org/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.
* [http://appdb.winehq.org/ The Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)
 
* [http://forum.winehq.org/ The WineHQ Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB
 
}}
 
  
=== Unregister Wine file associations ===
+
[[Install]] the {{pkg|winetricks}} package (or alternatively {{AUR|winetricks-git}}). Then run it with:
 +
$ winetricks
  
By default, Wine takes over as the default application for a lot of formats. Some (e.g. {{ic|vbs}} or {{ic|chm}}) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. {{ic|gif}}, {{ic|jpeg}}, {{ic|txt}}, {{ic|js}}) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.
+
=== Performance ===
  
Wine's file associations are set in {{ic|~/.local/share/applications/}} as {{ic|wine-extension-{extension}.desktop}} files. Delete the files corresponding to the extensions you want to unregister. Or, to remove all wine extensions:
+
==== CSMT ====
  
  $ rm -f ~/.local/share/applications/wine-extension*.desktop
+
CSMT is a technology used by Wine to use a separate thread for the OpenGL calls to improve performance noticeably. Since Wine 3.2, CSMT is enabled by default. However, CSMT support needs to be enabled manually for Wine versions lower than 3.2. For vanilla Wine run {{ic|wine regedit}} and set the DWORD value for ''HKEY_CURRENT_USER -> Software > Wine > Direct3D > csmt'' to 0x01 (enabled). For wine-staging run {{ic|winecfg}} and enable it in the staging tab.
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*
 
  
Next, remove the old cache:
+
Note that CSMT may actually hurt performance for some applications - if this is the case, disable it by creating/setting the registry value to 0x00 (disabled).
  
$ rm -f ~/.local/share/applications/mimeinfo.cache
+
Further information:
$ rm -f ~/.local/share/mime/packages/x-wine*
+
*[http://www.phoronix.com/forums/showthread.php?93967-Wine-s-Big-Command-Stream-D3D-Patch-Set-Updated/page3&s=7775d7c3d4fa698089d5492bb7b1a435 Phoronix Forum discussion] with the CSMT developer Stefan Dösinger
$ rm -f ~/.local/share/mime/application/x-wine-extension*
 
  
And, update the cache:
+
==== Force OpenGL mode in games ====
  
  $ update-desktop-database ~/.local/share/applications
+
Some games might 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 {{Ic|-opengl}} parameter.
 +
  $ wine ''/path/to/3d_game.exe'' -opengl
  
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.
+
You should of course refer to your application's documentation and Wine's [http://appdb.winehq.org AppDB] for such application specific information.
  
=== Dual Head with different resolutions ===
+
==== DXVK ====
 +
[https://github.com/doitsujin/dxvk DXVK] is a promising new implementation for DirectX 10 and DirectX 11 over Vulkan. This should allow for greater performance, and in some cases, even better compatibility. Battlefield 1 for example, only runs under DXVK. On the other hand, DXVK does not support all Wine games (yet).
  
If you have issues with dual-head setups and different display resolutions you are probably missing {{Pkg|lib32-libxrandr}}.
+
To use it, install {{aur|dxvk-bin}}. Then run the following command to activate it in your Wineprefix (by default {{ic|~/.wine}}):
 +
$ WINEPREFIX=''your-prefix'' setup_dxvk install
  
=== exe-thumbnailer ===
+
{{note|For Wine versions below 3.5 you need to configure Vulkan support manually, following the instructions at [https://github.com/roderickc/wine-vulkan GitHub]. {{Pkg|wine}} and {{Pkg|wine-staging}} work out of the box.}}
  
This is a small piece of UI code meant to be installed with (or even before) Wine. It provides thumbnails for executable files that show the embedded icons when available, and also gives the user a hint that Wine will be used to open it. Details can be found at [http://wiki.winehq.org/exe-thumbnailer Wine wiki]. Install it with the {{AUR|gnome-exe-thumbnailer}} package.
+
{{warning|DXVK overrides the DirectX 10 and 11 DLLs, which may be considered cheating in online multiplayer games, and may get your account '''banned'''. Use at your own risk!}}
  
=== CSMT patch ===
+
==== Gallium Nine ====
{{Out of date|See wine-staging below}}
 
Currently [http://www.winehq.org/pipermail/wine-devel/2013-September/101106.html wine developers] experiment with stream/worker thread optimizations for Wine. You may experience an enormous performance improvement by using this experimental patched Wine versions. Many games may run as fast as on Windows or even faster. This Wine patch is is known as CSMT patch and works with NVidia and AMD graphics cards.
 
  
{{Note|This is ''still experimental code'', therefore, it may not work as expected. Please, report your experiences to the developers for helping with development of those patches.}}
+
With the open-source gallium-based drivers (mostly AMD cards) there is a [https://wiki.ixit.cz/d3d9 Gallium Direct3D state tracker] that aims to provide nearly-native performance for DirectX 9. In most cases it has less visual glitches than the upstream wine and doubles the performances. It consumes much less CPU time than CSMT.
  
The easy way is to install {{Pkg|playonlinux}}. Then install your game and activate the Wine version ''1.7.4-CSMT'' from the {{ic|Tools}} → {{ic|Manage Wine Versions}} menu in PlayOnLinux. For now it is recommended to use the patched Wine version ''1.7.4-CSMT''.
+
Install {{Pkg|wine-nine}} to use it. This is a standalone package that can be installed with any wine version. Use {{ic|wine ninewinecfg}} to check if it's enabled.
  
Open your game's configuration settings and copy the following settings to the {{ic|Miscellaneous}}/{{ic|Command to exec before running the program}} section of your game configuration settings:
+
=== Unregister existing Wine file associations ===
  
export WINEDEBUG=-all
+
By default, Wine takes over as the default application for a lot of formats. Some (e.g. {{ic|vbs}} or {{ic|chm}}) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. {{ic|gif}}, {{ic|jpeg}}, {{ic|txt}}, {{ic|js}}) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.
export LD_PRELOAD="libpthread.so.0 libGL.so.1"
 
export __GL_THREADED_OPTIMIZATIONS=0
 
export __GL_SYNC_TO_VBLANK=1
 
export __GL_YIELD="NOTHING"
 
export CSMT=enabled
 
  
Make sure you have disabled {{ic|StrictDrawOrdering}} from {{ic|Tools}} → {{ic|General}}.
+
Wine's file associations are set in {{ic|~/.local/share/applications/}} as {{ic|wine-extension-''extension''.desktop}} files. Delete the files corresponding to the extensions you want to unregister. Or, to remove all wine extensions:
  
=== CSMT via wine-staging ===
+
$ rm -f ~/.local/share/applications/wine-extension*.desktop
[http://www.wine-staging.com/ Wine-staging] includes CSMT support, and can be installed with the {{AUR|wine-staging}} package, or directly via the wine-staging [https://github.com/wine-compholio/wine-staging/wiki/Installation#-arch-linux Arch Linux repo].
+
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*
  
CSMT support needs to be enabled before it can be used, instructions can be found [https://github.com/wine-compholio/wine-staging/wiki/CSMT#enabledisable-csmt here], no further configuration is needed.
+
Next, remove the old cache:
==== Further Information ====
 
  
[http://www.phoronix.com/forums/showthread.php?93967-Wine-s-Big-Command-Stream-D3D-Patch-Set-Updated/page3&s=7775d7c3d4fa698089d5492bb7b1a435 Phoronix Forum discussion] with the CSMT developer Stefan Dösinger
+
$ rm -f ~/.local/share/applications/mimeinfo.cache
 +
$ rm -f ~/.local/share/mime/packages/x-wine*
 +
$ rm -f ~/.local/share/mime/application/x-wine-extension*
  
[http://wiki.winehq.org/FOSDEM2014?action=AttachFile&do=get&target=d3d-drivers.odp FOSDEM2014 CSMT presentation] of CSMT with benchmarks
+
And, update the cache:
  
[https://www.youtube.com/playlist?list=PL0P2a_sII2eTd8uq-azTNpQjiFLqBhDjg Here] you find some game videos running with CSMT enabled
+
$ update-desktop-database ~/.local/share/applications
 +
$ update-mime-database ~/.local/share/mime/
  
=== Changing the language ===
+
Alternatively you can delete all wine related stuff:
  
Some programs may not offer a language selection, they will guess the desired language upon the sytem 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 [[Locale|generated]] on your system), you can call Wine with the following setting:
+
$ find ~/.local/share -name "*wine*" | xargs -I '{}' --no-run-if-empty rm -r '{}'
  
LC_ALL=''xx_XX.encoding'' wine ''/path/to/program''
+
And update the cache as above.
  
For instance
+
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.
  
LC_ALL=it_IT.UTF-8 wine ''/path/to/program''
+
=== Prevent new Wine file associations ===
  
=== Installing Microsoft Office 2010 ===
+
Prevent wine from creating any file associations by editing the registry:
{{Note|Microsoft Office 2013 does not run at all.}}
 
  
Microsoft Office 2010 works without any problems (tested with Microsoft Office Home and Student 2010, Wine 1.5.27 and 1.7.5). Activation over Internet also works.
+
{{hc|1=associations.reg|2=
 +
Windows Registry Editor Version 5.00
 +
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices]
 +
"winemenubuilder"="C:\\windows\\system32\\winemenubuilder.exe -r"
 +
}}
  
Start by installing {{pkg|wine-mono}}, {{pkg|wine_gecko}}, {{pkg|samba}}, {{pkg|lib32-libxslt}} and {{pkg|lib32-libxml2}}.
+
Add this to your Wine registry, by running {{ic|wine regedit associations.reg}}, or alternatively by running {{ic|wine regedit}} and importing it from the menu in ''Registry > Import Registry File''.
  
Proceed with launching the installer:
+
This has to be done for each WINEPREFIX which should not update file associations.
$ export WINEPREFIX=~/.wine # Wine prefix to use
 
$ export WINEARCH=win32
 
$ wine /path/to/office_cd/setup.exe
 
  
If you do not want to setup Office in the default Wine prefix ({{ic|~/.wine}}), create new one as described in [[#WINEPREFIX]] section. You could also put the above exports into your shell initialization script as also noted there.
+
This method prevents the creation of file associations but retains the creation of XDG .desktop files (that you might see e.g. in menus).
  
Once installation has completed, open Word or Excel to activate over the Internet. After activation run ''winecfg'' and set {{ic|riched20}} (under libraries) to {{ic|(native,builtin)}}. This will enable PowerPoint to work.
+
If you want it to apply by default for new WINEPREFIXES, edit {{ic|/usr/share/wine/wine.inf}}.
 +
Find this line:
  
For additional info, see the [http://appdb.winehq.org/appview.php?iVersionId=4992 WineHQ] article.
+
HKLM,%CurrentVersion%\RunServices,"winemenubuilder",2,"%11%\winemenubuilder.exe -a -r"
  
{{Note|For OneNote to work, run {{ic|winetricks wininet}} and then make sure that {{ic|wininet}} is set to {{ic|(native,builtin)}}.}}
+
and remove the -a switch, so that the entry looks like this:
  
{{Note|If the activation over internet does not work and you want to activate by phone, be sure {{ic|riched20}} is set to {{ic|(native,builtin)}} in order to see the drop-down list of countries.}}
+
HKLM,%CurrentVersion%\RunServices,"winemenubuilder",2,"%11%\winemenubuilder.exe -r"
  
{{Note|{{Pkg|playonlinux}} provides custom installer scripts that make the installation of Office 2003, 2007 and 2010 an ease. You just have to provide the ''setup.exe'' or ISO and the installer will guide you seamlessly through the installation procedure. You do not have to deal with the underlying Wine at all. The playonlinux installation for Office 2010 improves on the minimum installation instructions provided above by enabling xml conversions for Word documents created with certain earlier versions of Word.}}
+
See [https://askubuntu.com/a/400430 this post] for more info.
  
=== Proper mounting of optical media images ===
+
To prevent a package upgrade from overriding the modified file, create a pacman hook to make our change automatically:
  
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''.
+
{{hc|1=/etc/pacman.d/hooks/stop-wine-associations.hook|2=
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.
+
[Trigger]
 +
Type = File
 +
Operation = Install
 +
Operation = Upgrade
 +
Target = usr/share/wine/wine.inf
  
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). CDEmu will handle it correctly.
+
[Action]
 +
Description = Stopping Wine from hijacking file associations...
 +
When = PostTransaction
 +
Exec = /usr/bin/sed -i 's/winemenubuilder.exe -a -r/winemenubuilder.exe -r/g' /usr/share/wine/wine.inf
 +
}}
  
=== Burning optical media ===
+
See [[Pacman#Hooks]].
  
To burn CDs or DVDs, you will need to load the {{ic|sg}} [[kernel module]].
+
Alternatively, you can disable winemenubuilder altogether (including the desktop entries) for all WINEPREFIXes by setting an environment variable:
  
=== OpenGL modes ===
+
$ export WINEDLLOVERRIDES="winemenubuilder.exe=d"
  
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 {{Ic|-opengl}} parameter.
+
=== Execute Windows binaries with Wine implicitly ===
$ wine /path/to/3d_game.exe -opengl
 
  
You should of course refer to your application's documentation and Wine's [http://appdb.winehq.org AppDB] for such application specific information.
+
The {{pkg|wine}} package installs a ''binfmt'' file which will allow you to run Windows programs directly, e.g. {{ic|''./myprogram.exe''}} will launch as if you had typed {{ic|wine ''./myprogram.exe''}}. All you have to do in order to use this is to [[start]]/[[enable]] {{ic|systemd-binfmt.service}}.
  
=== Using Wine as an interpreter for Win16/Win32 binaries ===
+
{{Note|Make sure the Windows binary is executable, otherwise the binary will not be executed: e.g. run {{ic|chmod +x ''windows-binary''}}.}}
  
It is also possible to tell the kernel to use Wine as an interpreter for all Win16/Win32 binaries:
+
=== Dual Head with different resolutions ===
echo ':DOSWin:M::MZ::/usr/bin/wine:' > /proc/sys/fs/binfmt_misc/register
 
  
To make the setting permanent, create a {{ic|/etc/binfmt.d/wine.conf}} file with the following content:
+
If you have issues with dual-head setups and different display resolutions you are probably missing {{Pkg|lib32-libxrandr}}.
# Start WINE on Windows executables
 
:DOSWin:M::MZ::/usr/bin/wine:
 
  
[[systemd]] automatically mounts the {{ic|/proc/sys/fs/binfmt_misc}} filesystem using {{ic|proc-sys-fs-binfmt_misc.mount}} (and automount) and runs the {{ic|systemd-binfmt.service}} to load your settings.
+
Also installing {{Pkg|lib32-libxinerama}} might fix dual-head issues with wine (for example, unclickable buttons and menus of application in the right most or bottom most monitor, not redrawable interface of application in that zone, dragging mouse cursor state stucked after leaving application area).
  
Try it out by running a Windows program:
+
=== Burning optical media ===
$ chmod +x ''exefile.exe''
 
$ ./''exefile.exe''
 
  
If all went well, ''exefile.exe'' should run.
+
To burn CDs or DVDs, you will need to load the {{ic|sg}} [[kernel module]].
  
=== Wineconsole ===
+
=== Proper mounting of optical media images ===
  
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:
+
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.
  
$ wineconsole cmd
+
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). CDEmu will handle it correctly.
  
Then navigate to the directory and run the ''.exe'' file from there.
+
=== Show FPS overlay in games ===
  
=== Winetricks ===
+
Wine features an embedded FPS monitor which works for all graphical applications if the environment variable {{ic|1=WINEDEBUG=fps}} is set. This will output the framerate to stdout. You can display the FPS on top of the window thanks to {{ic|osd_cat}} from the {{pkg|xosd}} package. See [https://gist.github.com/anonymous/844aefd70bb50bf72b35 winefps.sh] for a helper script.
  
[http://wiki.winehq.org/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.
+
=== Running Wine under a separate user account ===
  
[[Install]] the {{pkg|winetricks}} package (or alternatively {{AUR|winetricks-git}}). Then run it with:
+
It may be desirable to run Wine under a specifically created user account in order to reduce concerns about Windows applications having access to your home directory.
$ winetricks
 
  
=== Installing .NET framework 4.0 ===
+
First, create a [[user account]] for Wine:
First create a new 32-bit Wine prefix if you are on a 64-bit system.
 
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg
 
  
Then install the following packages using winetricks
+
  # useradd -m -s /bin/bash wineuser
  $ WINEARCH=win32 WINEPREFIX=~/win32 winetricks -q msxml3 dotnet40 corefonts
 
  
=== Crackling sound when using PulseAudio ===
+
Now switch to another TTY and start your X WM or DE as you normally would or keep reading...
If you experience crackling sound in Wine applications when PulseAudio is in use, edit the file {{ic|/etc/pulse/daemon.conf}} by uncommenting the line {{ic|; default-fragment-size-msec &#61; 25}} and setting the value to {{ic|5}} such that it looks like this:
 
  
default-fragment-size-msec = 5
+
{{Note|The following approach only works when enabling root for Xorg. See [[Xorg#Rootless Xorg]] for more information.}}
  
See [http://wiki.winehq.org/FAQ#head-58290651b9f85c059a8bfc98118a0262e2cca84b here] for further information.
+
Afterwards, in order to open Wine applications using this new user account you need to add the new user to the X server permissions list:
  
=== 16 Bit Programs ===
+
$ xhost +SI:localuser:wineuser
Upon running older Windows 9x programs, the following error may be encountered:
 
  
modify_ldt: Invalid argument
+
Finally, you can run Wine via the following command, which uses {{ic|env}} to launch Wine with the environment variables it expects:
err:winediag:build_module Failed to create module for "krnl386.exe",
 
16-bit LDT support may be missing.
 
err:module:attach_process_dlls "krnl386.exe16" failed to initialize,
 
aborting
 
  
In this case, running the following may fix it:
+
$ sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine ''arguments''
  
echo 1 > /proc/sys/abi/ldt16
+
It is possible to automate the process of running Windows applications with Wine via this method by using a shell script as follows:
 +
{{hc|1=/usr/local/bin/runaswine|2=
 +
#!/bin/bash
 +
xhost +SI:localuser:wineuser
 +
sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine "$@"}}
  
Source: [http://www.spinics.net/linux/fedora/fedora-users/msg450821.html Fedora Mailing List]
+
Wine applications can then be launched via:
  
== Third-party interfaces ==
+
$ runaswine ''"C:\path\to\application.exe"''
  
These have their own sites, and are ''not supported'' in the official Wine forums/bugzilla.
+
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: {{ic|1=''mainuser'' ALL=(wineuser) NOPASSWD: ALL}}. See [[Sudo#Configuration]] for more information.
  
=== CrossOver ===
+
It is recommended to run {{ic|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.
  
[http://www.codeweavers.com/about/ CrossOver] Has its own [[CrossOver|wiki page]].
+
Keep in mind that audio will probably be non-functional in Wine programs which are run this way if [[PulseAudio]] is used. See [[PulseAudio/Examples#Allowing multiple users to use PulseAudio at the same time]] for information about allowing the Wine user to access the PulseAudio daemon of the principal user.
  
=== PlayOnLinux/PlayOnMac ===
+
=== Temp directory on tmpfs ===
  
[http://www.playonlinux.com/ PlayOnLinux] is a graphical Windows and DOS program manager. It contains scripts to assist the configuration and running of programs, it can manage multiple Wine versions and even use a specific version for each executable (e.g. because of regressions). If you need to know which Wine version works best for a certain game, try the [http://appdb.winehq.org/ Wine Application Database]. You can find the {{Pkg|playonlinux}} package in [[community]].
+
To prevent Wine from writing its temporary files to a physical disk, one can define an alternative location, like ''tmpfs''. Remove Wine's default directory for temporary files and creating a symlink:
  
=== PyWinery ===
+
$ rm -r ~/.wine/drive_c/users/$USER/Temp
 +
$ ln -s /tmp/ ~/.wine/drive_c/users/$USER/Temp
  
[https://github.com/ergoithz/pywinery PyWinery] is a graphical and simple wine-prefix manager which allows you to launch apps and manage configuration of separate prefixes, also have a button to open winetricks in the same prefix, to open prefix dir, ''winecfg'', application uninstaller and wineDOS. You can install You can install PyWinery with the {{AUR|pywinery}} package. It is especially useful for having differents settings like DirectX games, office, programming, etc, and choose which prefix to use before you open an application or file.
+
=== Prevent installing Mono/Gecko ===
 +
If Gecko and/or Mono are not present on the system nor in the Wine prefix, Wine will prompt to download them from the internet. If you do not need Gecko and/or Mono, you might want to disable this dialog, by  setting the {{ic|WINEDLLOVERRIDES}} [[environment variable]] to {{ic|1=mscoree=d;mshtml=d}}.
  
It is recommended using winetricks by default to open ''.exe'' files, so you can choose between any Wine configuration you have.
+
=== Vulkan ===
 +
Vulkan support is included, since Wine 3.3. The default Wine Vulkan ICD loader works fine for most applications, but does not support advanced features, like Vulkan layers. To use these features, you have to install the official Vulkan SDK, see step 2-4 on the original Vulkan patches author's [https://github.com/roderickc/wine-vulkan GitHub page].
  
=== Q4wine ===
+
{{note|The Wine ICD loader was added in Wine 3.5, you need to install the official Vulkan SDK to use Vulkan in Wine 3.3 and 3.4}}
  
[http://sourceforge.net/projects/q4wine/ Q4Wine] is a graphical wine-prefix manager which allows you to manage configuration of prefixes. Notably it allows exporting [[Qt]] themes into the Wine configuration so that they can integrate nicely. You can find the {{Pkg|q4wine}} package in [[multilib]].
+
=== Remove Wine file bindings ===
 +
For security reasons it may be useful to remove the preinstalled Wine bindings so Windows applications can't be launched directly from a file manager or from the browser (Firefox offers to open EXE files directly with Wine!).
 +
If you want to do this, you may add the following to the {{ic|1= [options]}} section in {{ic|1= /etc/pacman.conf}}
  
=== Wine-staging ===
+
NoExtract = usr/lib/binfmt.d/wine.conf
[http://www.wine-staging.com/ Wine-Staging] (formerly wine-compholio) is a special wine version containing bug fixes and features, which are not yet available in regular wine versions. The idea of Wine Staging is to provide new features faster to end users and to give developers the possibility to discuss and improve their patches before they are sent upstream. Available via the {{AUR|wine-staging}} package or directly via the wine-staging [https://github.com/wine-compholio/wine-staging/wiki/Installation#-arch-linux Arch Linux repo].
+
NoExtract = usr/share/applications/wine.desktop
  
 
== See also ==
 
== See also ==
  
* [http://www.winehq.com/ Official Wine website]
+
* [https://www.winehq.org/ Wine Homepage]
* [http://appdb.winehq.org/ Wine application database]
+
* [https://wiki.winehq.org/ Wine Wiki]
* [http://linuxgamingtoday.wordpress.com/2008/02/16/quick-tips-to-speed-up-your-gaming-in-wine/ Advanced configuring of video card and OpenGL in Wine; Speed up Wine]
+
* [https://appdb.winehq.org/ Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)
* [http://wiki.gotux.net/code:perl:fileinfo FileInfo] - Find Win32 PE/COFF headers in exe/dll/ocx files under Linux/Unix environment.
+
* [https://forum.winehq.org/ Wine Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB
* [https://wiki.gentoo.org/wiki/Wine Gentoo's Wine Wiki Page]
+
* [https://wiki.gentoo.org/wiki/Wine Wine - Gentoo Wiki]

Latest revision as of 18:21, 3 October 2019

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.

Warning: If you can access a file or resource with your user account, programs running in Wine can too. See #Running Wine under a separate user account and Security#Sandboxing applications for possible precautions.

Installation

Wine can be installed by enabling the multilib repository and installing the wine (stable) or wine-staging (testing) package. Wine Staging is a patched version of Wine, which contains bug fixes and features that have not been integrated into the stable branch yet. See also #Graphics drivers and #Sound.

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.

Third-party applications

These have their own communities and websites, and are not supported by greater Wine community. See Wine Wiki for more details.

  • CrossOver — Paid, commercialized version of Wine which provides more comprehensive end-user support.
https://www.codeweavers.com || crossoverAUR
  • exe-thumbnailer — Generates thumbnails for Windows executable files (.exe, .lnk, .msi, and .dll).
https://github.com/exe-thumbnailer/exe-thumbnailer || exe-thumbnailerAUR
  • Lutris — Gaming launcher for all types of games, including Wine games (with prefix management), native Linux games and emulators.
https://lutris.net || lutris
  • PlayOnLinux — Graphical prefix manager for Wine. Contains scripts to assist with program installation and configuration.
https://www.playonlinux.com || playonlinux
  • Proton — Compatibility tool made for Steam based on Wine and additional components. See ProtonDB for compatibility list.
https://github.com/ValveSoftware/Proton || protonAUR
  • PyWinery — Simple graphical prefix manager for Wine.
https://github.com/ergoithz/pywinery || pywineryAUR
  • Q4Wine — Graphical prefix manager for Wine. Can export Qt themes into the Wine configuration for better integration.
https://sourceforge.net/projects/q4wine/ || q4wineAUR

Configuration

Configuring Wine is typically accomplished using:

  • winecfg is a GUI configuration tool for Wine, which can be started by running winecfg.
  • regedit is Wine's registry editing tool, which can be started by running regedit. See WineHQ's article on Useful Registry Keys.
  • control is Wine's implementation of the Windows Control Panel, which can be started by running wine control.
  • See WineHQ's List of Commands for the full list.

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:

$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg
$ WINEPREFIX=~/win64 winecfg

You can also use WINEARCH in combination with other Wine programs, such as winetricks (using Steam as an example):

WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam

Graphics drivers

You need to install the 32-bit version of your graphics driver. Please install the package that is listed in the OpenGL (multilib) column in the table in Xorg#Driver installation.

A good sign that your drivers are inadequate or not properly configured is when Wine reports the following in your terminal window:

Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly
Note: You might need to restart X after having installed the correct library.

Sound

By default sound issues may arise when running Wine applications. Ensure only one sound device is selected in winecfg.

  • If you want to use the ALSA driver in Wine, you will need to install lib32-alsa-lib and lib32-alsa-plugins.
  • If you want to use the PulseAudio driver in Wine, you will need to install the lib32-libpulse package.
  • 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 winecfg still fails to detect the audio driver (Selected driver: (none)), configure it via the registry. For example, in a case where the microphone was not 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.
  • Some applications that use a color management engine (e.g. pdf viewers, image viewers, etc) may require lib32-lcms2.
  • Some applications that require encryption support may require lib32-gnutls.

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

Wine uses freetype to render fonts, and freetype's defaults changed a few releases ago. Try using this environment setting for wine programs:

 FREETYPE_PROPERTIES="truetype:interpreter-version=35"

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:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]
"ClientSideWithRender"="N"

For high resolution displays, you can adjust dpi values in winecfg.

See also Font configuration#Applications without fontconfig support.

Enable font smoothing

A good way to improve wine font rendering is to enable cleartype font smoothing. To enable "Subpixel smoothing (ClearType) RGB":

cat << EOF > /tmp/fontsmoothing
REGEDIT4

[HKEY_CURRENT_USER\Control Panel\Desktop]
"FontSmoothing"="2"
"FontSmoothingOrientation"=dword:00000001
"FontSmoothingType"=dword:00000002
"FontSmoothingGamma"=dword:00000578
EOF

WINE=${WINE:-wine} WINEPREFIX=${WINEPREFIX:-$HOME/.wine} $WINE regedit /tmp/fontsmoothing 2> /dev/null

For more information, check the original answer

Desktop launcher menus

When a Windows application installer creates a shortcut Wine creates a .desktop file instead. The default locations for those files in Arch Linux are:

  • Desktop shortcuts are put in ~/Desktop
  • Start menu shortcuts are put in ~/.local/share/applications/wine/Programs/
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). This can be achieved by installing wine-installerAUR meta-package, otherwise 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/:

wine-browsedrive.desktop
[Desktop Entry]
Name=Browse C: Drive
Comment=Browse your virtual C: drive
Exec=wine winebrowser c:
Terminal=false
Type=Application
Icon=folder-wine
Categories=Wine;
wine-uninstaller.desktop
[Desktop Entry]
Name=Uninstall Wine Software
Comment=Uninstall Windows applications for Wine
Exec=wine uninstaller
Terminal=false
Type=Application
Icon=wine-uninstaller
Categories=Wine;
wine-winecfg.desktop
[Desktop Entry]
Name=Configure Wine
Comment=Change application-specific and general Wine options
Exec=winecfg
Terminal=false
Icon=wine-winecfg
Type=Application
Categories=Wine;

And create the following file in ~/.config/menus/applications-merged/:

wine.menu
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd">
<Menu>
  <Name>Applications</Name>
  <Menu>
    <Name>wine-wine</Name>
    <Directory>wine-wine.directory</Directory>
    <Include>
      <Category>Wine</Category>
    </Include>
  </Menu>
</Menu>

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):

$ rm ~/.local/share/mime/packages/x-wine*
$ rm ~/.local/share/applications/wine-extension*
$ rm ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*
$ rm ~/.local/share/mime/application/x-wine-extension*

Appearance

A similar to XP looking theme can be downloaded from here. To install it see here. Lastly use winecfg to select it. Wine staging users may instead want to try enabling the option Enable GTK3 Theming under the Staging section of winecfg for a theme that matches the current GTK theme.

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.

See Wine FAQ and Wine User's Guide for general information on Wine usage.

See Wine Application Database (AppDB) for information on running Windows applications in Wine.

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.

Install the winetricks package (or alternatively winetricks-gitAUR). Then run it with:

$ winetricks

Performance

CSMT

CSMT is a technology used by Wine to use a separate thread for the OpenGL calls to improve performance noticeably. Since Wine 3.2, CSMT is enabled by default. However, CSMT support needs to be enabled manually for Wine versions lower than 3.2. For vanilla Wine run wine regedit and set the DWORD value for HKEY_CURRENT_USER -> Software > Wine > Direct3D > csmt to 0x01 (enabled). For wine-staging run winecfg and enable it in the staging tab.

Note that CSMT may actually hurt performance for some applications - if this is the case, disable it by creating/setting the registry value to 0x00 (disabled).

Further information:

Force OpenGL mode in games

Some games might 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.

DXVK

DXVK is a promising new implementation for DirectX 10 and DirectX 11 over Vulkan. This should allow for greater performance, and in some cases, even better compatibility. Battlefield 1 for example, only runs under DXVK. On the other hand, DXVK does not support all Wine games (yet).

To use it, install dxvk-binAUR. Then run the following command to activate it in your Wineprefix (by default ~/.wine):

$ WINEPREFIX=your-prefix setup_dxvk install
Note: For Wine versions below 3.5 you need to configure Vulkan support manually, following the instructions at GitHub. wine and wine-staging work out of the box.
Warning: DXVK overrides the DirectX 10 and 11 DLLs, which may be considered cheating in online multiplayer games, and may get your account banned. Use at your own risk!

Gallium Nine

With the open-source gallium-based drivers (mostly AMD cards) there is a Gallium Direct3D state tracker that aims to provide nearly-native performance for DirectX 9. In most cases it has less visual glitches than the upstream wine and doubles the performances. It consumes much less CPU time than CSMT.

Install wine-nine to use it. This is a standalone package that can be installed with any wine version. Use wine ninewinecfg to check if it's enabled.

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:

$ rm -f ~/.local/share/applications/wine-extension*.desktop
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*

Next, remove the old cache:

$ rm -f ~/.local/share/applications/mimeinfo.cache
$ rm -f ~/.local/share/mime/packages/x-wine*
$ rm -f ~/.local/share/mime/application/x-wine-extension*

And, update the cache:

$ update-desktop-database ~/.local/share/applications
$ update-mime-database ~/.local/share/mime/

Alternatively you can delete all wine related stuff:

$ find ~/.local/share -name "*wine*" | xargs -I '{}' --no-run-if-empty rm -r '{}'

And update the cache as above.

Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.

Prevent new Wine file associations

Prevent wine from creating any file associations by editing the registry:

associations.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices]
"winemenubuilder"="C:\\windows\\system32\\winemenubuilder.exe -r"

Add this to your Wine registry, by running wine regedit associations.reg, or alternatively by running wine regedit and importing it from the menu in Registry > Import Registry File.

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

This method prevents the creation of file associations but retains the creation of XDG .desktop files (that you might see e.g. in menus).

If you want it to apply by default for new WINEPREFIXES, edit /usr/share/wine/wine.inf. Find this line:

HKLM,%CurrentVersion%\RunServices,"winemenubuilder",2,"%11%\winemenubuilder.exe -a -r"

and remove the -a switch, so that the entry looks like this:

HKLM,%CurrentVersion%\RunServices,"winemenubuilder",2,"%11%\winemenubuilder.exe -r"

See this post for more info.

To prevent a package upgrade from overriding the modified file, create a pacman hook to make our change automatically:

/etc/pacman.d/hooks/stop-wine-associations.hook
[Trigger]
Type = File
Operation = Install
Operation = Upgrade
Target = usr/share/wine/wine.inf

[Action]
Description = Stopping Wine from hijacking file associations...
When = PostTransaction
Exec = /usr/bin/sed -i 's/winemenubuilder.exe -a -r/winemenubuilder.exe -r/g' /usr/share/wine/wine.inf

See Pacman#Hooks.

Alternatively, you can disable winemenubuilder altogether (including the desktop entries) 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/enable systemd-binfmt.service.

Note: Make sure the Windows binary is executable, otherwise the binary will not be executed: e.g. run chmod +x windows-binary.

Dual Head with different resolutions

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

Also installing lib32-libxinerama might fix dual-head issues with wine (for example, unclickable buttons and menus of application in the right most or bottom most monitor, not redrawable interface of application in that zone, dragging mouse cursor state stucked after leaving application area).

Burning optical media

To burn CDs or DVDs, you will need to load the sg kernel module.

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.

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.

Running Wine under a separate user account

It may be desirable to run Wine under a specifically created user account in order to reduce concerns about Windows applications having access to your home directory.

First, create a user account for Wine:

# useradd -m -s /bin/bash wineuser

Now switch to another TTY and start your X WM or DE as you normally would or keep reading...

Note: The following approach only works when enabling root for Xorg. See Xorg#Rootless Xorg for more information.

Afterwards, in order to open Wine applications using this new user account you need to add the new user to the X server permissions list:

$ xhost +SI:localuser:wineuser

Finally, you can run Wine via the following command, which uses env to launch Wine with the environment variables it expects:

$ sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine arguments

It is possible to automate the process of running Windows applications with Wine via this method by using a shell script as follows:

/usr/local/bin/runaswine
#!/bin/bash
xhost +SI:localuser:wineuser
sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine "$@"

Wine applications can then be launched via:

$ runaswine "C:\path\to\application.exe"

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.

Keep in mind that audio will probably be non-functional in Wine programs which are run this way if PulseAudio is used. See PulseAudio/Examples#Allowing multiple users to use PulseAudio at the same time for information about allowing the Wine user to access the PulseAudio daemon of the principal user.

Temp directory on tmpfs

To prevent Wine from writing its temporary files to a physical disk, one can define an alternative location, like tmpfs. Remove Wine's default directory for temporary files and creating a symlink:

$ rm -r ~/.wine/drive_c/users/$USER/Temp
$ ln -s /tmp/ ~/.wine/drive_c/users/$USER/Temp

Prevent installing Mono/Gecko

If Gecko and/or Mono are not present on the system nor in the Wine prefix, Wine will prompt to download them from the internet. If you do not need Gecko and/or Mono, you might want to disable this dialog, by setting the WINEDLLOVERRIDES environment variable to mscoree=d;mshtml=d.

Vulkan

Vulkan support is included, since Wine 3.3. The default Wine Vulkan ICD loader works fine for most applications, but does not support advanced features, like Vulkan layers. To use these features, you have to install the official Vulkan SDK, see step 2-4 on the original Vulkan patches author's GitHub page.

Note: The Wine ICD loader was added in Wine 3.5, you need to install the official Vulkan SDK to use Vulkan in Wine 3.3 and 3.4

Remove Wine file bindings

For security reasons it may be useful to remove the preinstalled Wine bindings so Windows applications can't be launched directly from a file manager or from the browser (Firefox offers to open EXE files directly with Wine!). If you want to do this, you may add the following to the [options] section in /etc/pacman.conf

NoExtract = usr/lib/binfmt.d/wine.conf
NoExtract = usr/share/applications/wine.desktop

See also