Anonymous edits have been disabled on the wiki. If you want to contribute please login or create an account.


Warning for game developers: PCGamingWiki staff members will only ever reach out to you using the official press@pcgamingwiki.com mail address.
Be aware of scammers claiming to be representatives or affiliates of PCGamingWiki who promise a PCGW page for a game key.

Difference between revisions of "Wine"

From PCGamingWiki, the wiki about fixing PC games
m (Robot: Cosmetic changes)
Line 1: Line 1:
Wine is a free and open source software application that aims to allow computer programs written for [[Windows (Operating System)|Windows]] to run on Unix-like operating systems.
+
Wine is a free and open source software application that aims to allow computer programs written for [[Microsoft Windows|Windows]] to run on Unix-like operating systems.
  
== Difference between emulation and wine ==
+
To achieve this goal, Wine duplicates functions of the Windows operating system by providing both alternative implementations of the DLLs that Windows programs call and a process to substitute the Windows NT kernel.
Wine does not stand for "Windows Emulator", it specifically stands for "Wine is not an Emulator"
 
  
An emulator slows execution by emulating hardware with software, wine creates duplicate libraries which link through to native functions in your operating system of choice.
+
''Note that it is recommended that you have at least basic knowledge of the Terminal/shell before using Wine. If you do not, then try [[Wine#Wineskin|Wineskin]].''
  
When a game asks [[DirectX]] to render a circle, the function it is accessing is actually a similarly named Wine function. This function then tells [[OpenGL]] to render a circle. This overhead is minimal, and is often offset by alternative operating systems not requiring anti-virus programs or firewalls, and their lesser bloat.
+
== Linux ==
 +
=== Installation ===
 +
Most distributions of Linux come with Wine pre-installed. However, if it is not, or if you would like the latest version, then it can easily be downloaded from http://www.winehq.org/download/.
 +
== Mac ==
 +
=== Installation ===
 +
Wine requires Xcode, which can be downloaded and installed [https://itunes.apple.com/app/xcode/id497799835 via the Mac App Store] on OS X 10.6 and above, or [https://developer.apple.com/downloads via the Apple Developer downloads section].
  
== Mac usage ==
+
MacPorts is also required, which can be download and installed from http://www.macports.org/. It then needs to be configured by entering the following two commands into the Terminal:
Mac users can download and install Wine using [http://www.macports.org/ MacPorts].  
 
  
A detailed tutorial for Mac download, installation and usage can be found at [http://www.davidbaumgold.com/tutorials/wine-mac/ davidbaumgold.com].
+
<code>echo export PATH=/opt/local/bin:/opt/local/sbin:\$PATH$'\n'export MANPATH=/opt/local/man:\$MANPATH | sudo tee -a /etc/profile</code>
  
=== GUI applications ===
+
<code>if [ `sysctl -n hw.cpu64bit_capable` -eq 1 ] ; then echo "+universal" | sudo tee -a /opt/local/etc/macports/variants.conf; else echo "not 64bit capable"; fi</code>
There are also GUI applications for those who do not want to get into the nitty-gritty of terminal-based computing:
 
* '''[http://wineskin.doh123.com/ {{Anchor|Wineskin}}]''' is an easy to use application, that created applications with simple a simple installer for Windows programs. Most, if not all, gamers can get away with simply using Wineskin.
 
  
== Tutorial ==
+
After this, you may need to agree to the Xcode license, which you can do so by running the following in the Terminal:
This is a beginners guide on getting Windows programs to run in Wine, some games may require manual compilation or other tweaks.
 
  
The techniques listed here are designed for [[GNU/Linux|Linux]], but other operating systems such as [[Mac OS X (Operating System)|Mac OS X]] can implement them in much the same way.
+
<code>sudo xcodebuild -license</code>
  
Note that several programs can be installed and run with tools such as [http://www.playonlinux.com PlayOnLinux], but this tutorial will teach you to do things manually, which comes in handy if the tools do not support a game, or do not work properly.
+
Then enter "agree" before closing and reopening the Terminal window.
  
=== Linux installation ===
+
Now you need to install Wine using MacPorts, by entering the following command (which may take several hours to do):
While most Linux distributions come with a version of Wine, more often than not you'll want to use a bleeding edge version to get newer games working.
 
  
You can [http://sourceforge.net/projects/wine/files/Source/ download the source code] and compile it yourself, or [http://www.playonlinux.com/wine/binaries/ download a pre-compiled version] from PlayOnLinux. Unless specifically stated otherwise, you should use a 32-bit version of wine.
+
<code>sudo port install wine</code>
  
=== Starter script ===
+
And then Wine will be installed and ready to use!
The following script can be used as a base to launch windows applications in wine.
 
  
#!/bin/bash
+
=== Making a Dock Icon ===
+
To make a dock icon for a Wine program we need to write a program in AppleScript that launches the Windows program. Open the script editor that came with your OS (which can be found in the ''/Applications/Utilities'' directory of the computer and is called something like "Script Editor" or "AppleScript Editor" depending on your OS version).
PATH="/home/$USER/wine/versions/1.3.24/bin:$PATH"
 
# This line prefixes a directory to your $PATH. Basically, when you run a command like "wine"
 
# it will look in that folder to run it. This lets you use different wine versions for different games.
 
# Replace the directory with whatever is the location of your wine version's binary files
 
 
export WINEPREFIX="/home/$USER/wine/prefixes/mygame"
 
# Every prefix contains it's own settings, it's own installed programs, and it's own "Hard drive"
 
# This allows you to install different games with widely ranging settings, without messing up other ones.
 
 
export WINEDEBUG="-all"
 
# This option should be disabled during install, or debugging. It stops wine from outputting errors, which
 
# can increase performance as there are often large amounts of data it attempts to output.
 
 
cd "$WINEPREFIX/drive_c/Program Files/mygame"
 
# Change to the directory your game is installed in
 
 
wine mygame.exe
 
# And run it in wine
 
 
# Other things you may want to keep in the file for convenience
 
 
#winecfg
 
# This allows you to configure the prefix, set up video settings, audio settings, and other options
 
 
#wineserver -k
 
# This will terminate all processes on the wineprefix, nice for stopping uncooperative windows programs.
 
 
#winetricks
 
# Winetricks is used for many tweaks to wine, which you will probably be using for some of the games you install.
 
  
Make sure to make the script executable before you try to run it:
+
Within the script editor enter the following (where ''$PATH_TO_PROGRAM'' is the path from the Program Files directory to your .exe file and ''TAB'' is a press of the tab button):
  
<code>$ chmod +x script</code>
+
<code>
 +
tell application "Terminal"
  
=== Tweaks ===
+
TABdo script "/opt/local/bin/wine ~/.wine/drive_c/Program\\ Files/$PATH_TO_PROGRAM.exe"
Several tweaks to wine can provide functionality ranging from the .NET framework to Internet Explorer.
 
  
==== Wine versions ====
+
end tell
A list of precompiled versions of Wine is available at [http://www.playonlinux.com/wine/binaries/ PlayOnLinux]
+
</code>
  
Later versions are supposed to be "Unstable" - however, later versions are usually required to get newer games to work.
+
Then press "Compile" and save the script where you like (making sure to select the "File Format: Application" in the save options, and leaving "Startup Screen" unchecked). Open up the Finder, go to where you saved the script and then drag the file to your Dock, where it will stay. You can then click on that Dock Icon to open up your Windows program.
  
If a game doesn't work with a specific version of Wine, try a different one.
+
== Installing Windows Programs ==
 +
Go to the directory where the Windows .exe installed file is in the Terminal/shell and then enter the following command (where ''INSTALLED.exe'' is the name of the .exe file):
  
==== Winecfg ====
+
<code>wine $INSTALLER.exe</code>
This is the default wine configuration tool, and allows you to change options ranging from the version of Windows, to the graphical capabilities, to the virtual hard drives in use by the prefix.
 
  
The tool can be accessed with the command:
+
A regular graphical Windows installer will soon appear, which you can click through to complete the installation.
 +
 
 +
== Running Windows Programs ==
 +
Open the Terminal/shell and go to your Program Files folder via the following command:
 +
 
 +
<code>cd ~/.wine/drive_c/Program\ Files/</code>
 +
 
 +
Run <code>ls</code> to see what Windows programs you have installed. To run a program enter its directory by using <code>cd DIRECTORY_NAME</code> (where ''DIRECTORY_NAME'' is the name of the directory with the program that you want to run. Within that directory there should be an .exe file which you can run with the following command (where ''PROGRAM.exe'' is the name of the .exe file):
 +
 
 +
<code>wine $PROGRAM.exe</code>
 +
 
 +
The program will soon appear, ready to use.
 +
 
 +
== Updating ==
 +
To keep Wine up-to-date, it is recommended to run the following command every few months or so via the Terminal/shell:
 +
 
 +
<code>sudo port selfupdate && sudo port upgrade outdated</code>
 +
 
 +
== Uninstalling ==
 +
On Mac, to uninstall both Wine and MacPorts, simply run the following command in the Terminal:
 +
 
 +
<code>sudo rm -rf /opt ~/.wine /Applications/MacPorts</code>
 +
 
 +
On Linux, or on Mac to uninstall just Wine, simply run the following command in the Termianl/shell:
 +
 
 +
<code>sudo port uninstall wine</code>
 +
 
 +
== Common Issues ==
 +
=== .NET/Mono ===
 +
Some Windows applications require the [[Wikipedia:.NET_Framework|.NET software framework]] to run (Wine will instruct you to install if an application you try to run requires it), which is not compatible with Wine. However, an open source piece of software called [http://mono-project.com/ Mono] was made to replace it. To install it, simply run the following two commands:
 +
 
 +
<code>sudo port install winetricks</code>
 +
 
 +
<code>winetricks mono210</code>
 +
=== D-bus (Mac) ===
 +
Some Windows applications require the [http://www.freedesktop.org/wiki/Software/dbus D-bus process] to run, in order to communicate with certain other applications. While it is installed along-side Macports, it will not run unless you tell it to. You only need to do this once, and then the process will run every time on startup:
 +
 
 +
<code>sudo launchctl load -w /Library/LaunchDaemons/org.freedesktop.dbus-system.plist</code>
  
<code>$ winecfg</code>
+
<code>launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist</code>
  
==== Winetricks ====
+
== APPDB ==
Winetricks is a script that automatically downloads, installs, and configures many tools for Wine. It also contains scripts to automatically install games.
+
[http://appdb.winehq.org/ The APPDB] (application database) gives help on installing and running specific Windows programs with Wine.
  
Installation instructions can be found at [http://wiki.winehq.org/winetricks the wine wiki].
+
== Wineskin ==
 +
[http://wineskin.urgesoftware.com Wineskin] is a program based on Wine that acts as a GUI interface, so that the Terminal/shell does not have to be used.
  
Use is very simple.
+
== Tweaking Wine ==
  
winetricks -h          # Help menu
+
=== Winecfg ===
winetricks ie6        # Installs internet explorer 6
+
Winecfg is the default wine configuration tool, and allows you to change options ranging from the version of Windows, to the graphical capabilities, to the virtual hard drives in use by the prefix.
winetricks mwo=force  # Forces mouse warp (For first person shooters where the mouse escapes the window)
 
winetricks vcrun2010  # Installs Visual C++ 2010 libraries
 
winetricks dotnet35    # Installs .NET 3.5
 
  
==== Manual compilation ====
+
The tool can be accessed with the command:
The most advanced tweak is to [http://sourceforge.net/projects/wine/files/Source/ manually download the source code], patch it, and compile it.
+
 
 +
<code>$ winecfg</code>
  
This last-ditch-effort allows you to run games that simply don't work with wine without alterations to the source code.
+
=== Winetricks ===
 +
[https://code.google.com/p/winetricks/ Winetricks] is a script that automatically downloads, installs, and configures many tools for Wine. It also contains scripts to automatically install games.
  
Compilation takes quite a while, and is very complicated, so I will only make one alteration to the [http://www.winehq.org/docs/wineusr-guide/installing-wine-source pre-existing tutorials].
+
== General Information ==
 +
[http://www.winehq.org/ The Wine Website]
  
When you run the configure script, give it a prefix, that way it will be compiled to it's own folder, ready to be used in the script above.
+
[http://wiki.winehq.org/ The Wine Wiki]
  
<code>$ ./configure --prefix=/home/$USER/wine/versions/custombuild</code>
+
[[Wikipedia:Wine_(software)|The Wine Wikipedia Page]]
<!-- arguable, but it puts it in categories so people can find it easier -->
 
  
 
[[Category:Hack]]
 
[[Category:Hack]]
 
[[Category:Wine]]
 
[[Category:Wine]]
 
[[Category:Emulation]]
 
[[Category:Emulation]]

Revision as of 17:26, 11 November 2012

Wine is a free and open source software application that aims to allow computer programs written for Windows to run on Unix-like operating systems.

To achieve this goal, Wine duplicates functions of the Windows operating system by providing both alternative implementations of the DLLs that Windows programs call and a process to substitute the Windows NT kernel.

Note that it is recommended that you have at least basic knowledge of the Terminal/shell before using Wine. If you do not, then try Wineskin.

Linux

Installation

Most distributions of Linux come with Wine pre-installed. However, if it is not, or if you would like the latest version, then it can easily be downloaded from http://www.winehq.org/download/.

Mac

Installation

Wine requires Xcode, which can be downloaded and installed via the Mac App Store on OS X 10.6 and above, or via the Apple Developer downloads section.

MacPorts is also required, which can be download and installed from http://www.macports.org/. It then needs to be configured by entering the following two commands into the Terminal:

echo export PATH=/opt/local/bin:/opt/local/sbin:\$PATH$'\n'export MANPATH=/opt/local/man:\$MANPATH | sudo tee -a /etc/profile

if [ `sysctl -n hw.cpu64bit_capable` -eq 1 ] ; then echo "+universal" | sudo tee -a /opt/local/etc/macports/variants.conf; else echo "not 64bit capable"; fi

After this, you may need to agree to the Xcode license, which you can do so by running the following in the Terminal:

sudo xcodebuild -license

Then enter "agree" before closing and reopening the Terminal window.

Now you need to install Wine using MacPorts, by entering the following command (which may take several hours to do):

sudo port install wine

And then Wine will be installed and ready to use!

Making a Dock Icon

To make a dock icon for a Wine program we need to write a program in AppleScript that launches the Windows program. Open the script editor that came with your OS (which can be found in the /Applications/Utilities directory of the computer and is called something like "Script Editor" or "AppleScript Editor" depending on your OS version).

Within the script editor enter the following (where $PATH_TO_PROGRAM is the path from the Program Files directory to your .exe file and TAB is a press of the tab button):

tell application "Terminal"

TABdo script "/opt/local/bin/wine ~/.wine/drive_c/Program\\ Files/$PATH_TO_PROGRAM.exe"

end tell

Then press "Compile" and save the script where you like (making sure to select the "File Format: Application" in the save options, and leaving "Startup Screen" unchecked). Open up the Finder, go to where you saved the script and then drag the file to your Dock, where it will stay. You can then click on that Dock Icon to open up your Windows program.

Installing Windows Programs

Go to the directory where the Windows .exe installed file is in the Terminal/shell and then enter the following command (where INSTALLED.exe is the name of the .exe file):

wine $INSTALLER.exe

A regular graphical Windows installer will soon appear, which you can click through to complete the installation.

Running Windows Programs

Open the Terminal/shell and go to your Program Files folder via the following command:

cd ~/.wine/drive_c/Program\ Files/

Run ls to see what Windows programs you have installed. To run a program enter its directory by using cd DIRECTORY_NAME (where DIRECTORY_NAME is the name of the directory with the program that you want to run. Within that directory there should be an .exe file which you can run with the following command (where PROGRAM.exe is the name of the .exe file):

wine $PROGRAM.exe

The program will soon appear, ready to use.

Updating

To keep Wine up-to-date, it is recommended to run the following command every few months or so via the Terminal/shell:

sudo port selfupdate && sudo port upgrade outdated

Uninstalling

On Mac, to uninstall both Wine and MacPorts, simply run the following command in the Terminal:

sudo rm -rf /opt ~/.wine /Applications/MacPorts

On Linux, or on Mac to uninstall just Wine, simply run the following command in the Termianl/shell:

sudo port uninstall wine

Common Issues

.NET/Mono

Some Windows applications require the .NET software framework to run (Wine will instruct you to install if an application you try to run requires it), which is not compatible with Wine. However, an open source piece of software called Mono was made to replace it. To install it, simply run the following two commands:

sudo port install winetricks

winetricks mono210

D-bus (Mac)

Some Windows applications require the D-bus process to run, in order to communicate with certain other applications. While it is installed along-side Macports, it will not run unless you tell it to. You only need to do this once, and then the process will run every time on startup:

sudo launchctl load -w /Library/LaunchDaemons/org.freedesktop.dbus-system.plist

launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist

APPDB

The APPDB (application database) gives help on installing and running specific Windows programs with Wine.

Wineskin

Wineskin is a program based on Wine that acts as a GUI interface, so that the Terminal/shell does not have to be used.

Tweaking Wine

Winecfg

Winecfg is the default wine configuration tool, and allows you to change options ranging from the version of Windows, to the graphical capabilities, to the virtual hard drives in use by the prefix.

The tool can be accessed with the command:

$ winecfg

Winetricks

Winetricks is a script that automatically downloads, installs, and configures many tools for Wine. It also contains scripts to automatically install games.

General Information

The Wine Website

The Wine Wiki

The Wine Wikipedia Page