Wine automatically adds certain mimetypes and file associations (e.g. notepad.exe for .ini files). There already is an answer that explains how to remove these associations.

But how can one prevent Wine from adding them again and again?


Disabling winemenubuilder.exe altogether will prevent wine from hijacking your file associations, but it will also prevent it from creating menu entries for newly installed software, which may be an undesired behavior. The better solution is this:

  1. Remove existing wine hijacks (from wine FAQ):

    rm -f ~/.local/share/mime/packages/x-wine*
    rm -f ~/.local/share/applications/wine-extension*
    rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*
    rm -f ~/.local/share/mime/application/x-wine-extension* 
  2. Edit /usr/share/wine/wine.inf (as root), find the [Services] section:

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

    and edit it so it says:

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

    (namely, to start winemenubuilder.exe without the -a switch). This will prevent updating file associations on new user accounts (or with new WINEPREFIXes).

  3. Edit your $WINEPREFIX/system.reg file (if it exists) in similar fashion. Where it says

    "winemenubuilder"="C:\\windows\\system32\\winemenubuilder.exe -a -r"

    remove the -a switch. (By default, WINEPREFIX=$HOME/.wine.)

This will prevent wine from stealing your preferred mimeapps, but the winemenubuilder will still run and create convenient desktop entries for your Windoze software.

  • 3
    For me the path was rather /opt/wine-staging/share/wine/wine.inf. If the file is in non-standard location, run locate wine.inf to find it.
    – Hi-Angel
    Mar 30 '16 at 4:30
  • And if you're using the stable Wine PPA, it's located at /opt/wine-stable/share/wine/wine.inf
    – wyphan
    Aug 5 at 22:43

From http://wiki.winehq.org/FAQ:

Users who do not want the installer for a Windows app to change filetype associations, add menu items, or create desktop links, can disable winemenubuilder.exe . There are several ways to do this:

  • In winecfg: before running the installer, run winecfg. Go to the Libraries tab and type winemenubuilder.exe into the "New overrides" box (it is not in the dropdown list). Click add, then select it from the "Existing overrides" box. Click "Edit" and select "Disable" from the list, then click "Apply".

  • Registry file: If you need to apply the setting many times (e.g. every time you recreate the Wine prefix), this approach may be more convenient. Create a text file named with extension .reg (e.g., disable-winemenubuilder.reg) containing the following:


    To apply the setting, run regedit disable-winemenubuilder.reg

  • Environment variable: set the WINEDLLOVERRIDES environment variable when you run the installer, e.g.,

    WINEDLLOVERRIDES=winemenubuilder.exe=d wine setup.exe

Disabling winemenubuilder.exe will cause wine programs to print errors that they cannot find it (though the errors do not seem to interfere with program operation).

An alternative approach that avoids the errors is to replace it with the do-nothing program. Compile the following with MinGW's gcc under wine and place the executable at C:\Windows\System32\winemenubuilder.exe:

  int main() { /* Do nothing */ return 0; }

Then follow the same procedure as above, but set winemenubuilder.exe to "native" instead of "disable".

  • Okay. So for me that means I create the prefix, install my app, remove all default wine associations and menus by hand (I want the apps associations) and then change the reg key to prevent the associations from being re-added every time Wine's updated, right?
    – mniess
    Jul 27 '13 at 16:48

Since this is the first hit on Google. The Wine FAQ now lists an alternative method for newer versions of wine.

"Beginning with wine-3.14, winecfg has a "Manage File Associations" checkbox on the Desktop Integration tab. Checking it enables winemenbuilder to create file associations and unchecking it disables that behavior."

  • 2
    This should probably be the accepted answer. That said, it doesn't work for me because I create a new WINEPREFIX for every Windows application I install.
    – hackerb9
    Jan 10 '20 at 4:40
  • 1
    I found this thread because wine-5.0 (Ubuntu 5.0-3ubuntu1) is stealing my xdg-mime desktop file associations. This option is unchecked and I only have one wine prefix, so I don't think it's working in this version Oct 12 '20 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.