Install Wine on Mac OS X 10.7 Lion and 10.8 Mountain Lion

03 January 2012 by ComputechTips
Categories: Apple, System | Tags: , | 11 comments

Wine (Windows Emulator) is a free and open-source application that aims to allow programs / softwares written for Microsoft Windows to run on Unix-like operating system such as Linux, BSD, Solaris and Mac OS X.

That said if you own Mac OS X based computers, you can run Windows applications such as Notepad, Mikrotik Winbox and more.

In this post I want to show you how to install Wine on Mac OS X Lion 10.7.2 (it should be also applicable for Snow Leopard 10.6, Leopard 10.5, and Tiger 10.4) via MacPorts.

UPDATE: For those of you who have upgraded to OS X Mountain Lion, you will be surprised that Wine will no longer work because Apple removes the X11 from Mountain Lion. The solution is you have to install XQuartz as the substitute of X11. You can download and install the XQuartz from XQuartz project website.

1. Download the MacPorts from its website. Select the appropriate file to meet with your Mac version. Note that you must have XCode and X11 (XQuartz in Mountain Lion) window environment installed in the system.

2. Once it’s downloaded, double-click the dmg file and follow the on-screen installation process. You have to be connected to internet while installing the MacPorts because it downloads the port files in a background process.

3. Once the MacPorts has been successfully installed, check whether the ‘port’ command is already in your PATH or not. In Mac OS X Lion, it should be already in the PATH. Otherwise run the below command to export the port into the PATH.

$ export PATH=$PATH:/opt/local/bin

4. Now we are ready to install the Wine via MacPorts by issuing ‘sudo port install wine’ as follow

$ sudo port install wine
Password:
Computing dependencies for wine
Dependencies to be installed: apple-gcc42 expat expat flex gettext libiconv gperf libiconv ncurses ncursesw ncurses fontconfig freetype bzip2 zlib zlib zlib freetype gnutls libgcrypt libgpg-error libtasn1 lzo2 pkgconfig glib2 libffi libffi perl5 perl5.12 gdbm gdbm perl5.12 perl5 perl5 xz xz glib2 pkgconfig readline jpeg jpeg lcms tiff tiff libpng libxml2 libxml2 libxslt mesa makedepend xorg-xproto py27-libxml2 python27 db46 libedit openssl openssl python_select sqlite3 xorg-dri2proto xorg-glproto xorg-libXfixes xorg-fixesproto xorg-libX11 xorg-bigreqsproto xorg-inputproto xorg-kbproto xorg-libXau xorg-libXdmcp xorg-libxcb xorg-libpthread-stubs xorg-xcb-proto xorg-util-macros xorg-xcmiscproto xorg-xextproto xorg-xf86bigfontproto xorg-xtrans xorg-libXi xorg-libXext autoconf help2man p5.12-locale-gettext m4 automake libtool xorg-libXi xorg-libXmu xorg-libXt xorg-libsm xorg-libice xorg-libsm xorg-libXcomposite xorg-compositeproto xorg-libXcursor xorg-renderproto xrender xrender xorg-libXinerama xorg-xineramaproto xorg-libXrandr xorg-randrproto xorg-libXxf86vm xorg-xf86vidmodeproto

Fetching apple-gcc42
Attempting to fetch gcc-5666.3.tar.gz from http://jog.id.distfiles.macports.org/macports/mpdistfiles/apple-gcc42

It will take a couple of minutes for the port script to retrieve, download, building and then install the wine and its dependency softwares. So be patient!.

When it’s done, you should see something like below:

Fetching archive for wine
Attempting to fetch wine-1.2.3_1.darwin_11.i386.tbz2 from http://packages.macports.org/wine
Fetching wine
Attempting to fetch wine-1.2.3.tar.bz2 from http://voxel.dl.sourceforge.net/project/wine/Source
Attempting to fetch wine_gecko-1.0.0-x86.cab from http://voxel.dl.sourceforge.net/project/wine/Wine%20Gecko/1.0.0
Verifying checksum(s) for wine
Extracting wine
Configuring wine
Building wine
Staging wine into destroot
Installing wine @1.2.3_1
Activating wine @1.2.3_1
Cleaning wine

If there is no error like above, the Wine has been successfully installed on Mac OS X and you are ready to run Microsoft Windows programs.

About ComputechTips

Computer and tech-related tips including how-tos, tutorials, and guides. Follow me at @computechtips

  • Gwong

    I have XCode4 on my MacBook OSX 10.7.2, but sudo port install wine returns:

    —> Computing dependencies for pkgconfig
    —> Configuring pkgconfig
    Error: Target org.macports.configure returned: configure failure: shell command failed (see log for details)
    Log for pkgconfig is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_pkgconfig/pkgconfig/main.log
    Error: Unable to upgrade port: 1
    Error: Unable to execute port: upgrade pkgconfig failed
    To report a bug, see

    Have you run into this or heard of this?

    TIA
    gary

    • http://computechtips.com/ Computechtips

      Hi Gwong,

      Thanks for dropping comment here.
      I’ve never run into this problem, but someone already posted the same problem in the MacPorts ticket. You can find the ticket at http://trac.macports.org/ticket/29611.

      According to the ticket discussions, some of your MacPorts might have been replaced with ones that are not the right architecture.

      I hope it will be useful for you to solve the problem.

      • http://profile.yahoo.com/WAJGN2NJZONVDQUVZAUMTSEEN4 kenshin

        I have tried what is above, unfortunately this what happened.

        Last login: Sun Sep 9 00:36:29 on console
        unknown-20-c9-d0-42-bb-5b:~ Bilan$ sudo port install wine
        Password:
        Sorry, try again.
        Password:
        sudo: port: command not found
        unknown-20-c9-d0-42-bb-5b:~ Bilan$

        • http://computechtips.com/ Computechtips

          The error message ‘port: command not found’ means that either you don’t have MacPorts installed or the path is not correctly set. Please refer to step 2 and 3 in the tutorial above.

    • WebNewbie

      Install Xcode < 4.3 from Launchpad Application. That's all.

  • Guest

    I have Xcode 4.4.1 and XQuartz, on my OSX 10.8. I have been trying to install wine onto my laptop for a couple days now without success. Even before finding this article and learning that I needed XQuartz I received this error when attempting to “sudo port install wine” :

    Error: org.macports.build for port libunwind-headers returned: command execution failed
    Error: Failed to install libunwind-headers

    • http://computechtips.com/ Computechtips

      Hi, thanks for leaving comment here. If you got this error, try to run ‘sudo xcodebuild -license’ and agree the license agreement. You may also need to update the port using ‘sudo port selfupdate’ and then upgrade the outdated packages using ‘sudo port upgrade outdated’. I hope this solve your problem.

  • Guest

    I followed all the steps but when I run sudo port install wine, my Mac freezes at “Building llvm-3.1″ to the point where I have to manually reboot it :(

  • lixjar

    I followed all the steps but when I run sudo port install wine, apple-gcc42 can’t be built!

  • JJ

    When I run sudo port install wine it says ‘sudo: port: command not found’ – How can I fix this?

    • http://computechtips.com/ Computechtips

      The error says that the ‘port’ command can not be found in the current path. Have you installed the MacPort package? By default, in my system it is in /opt/local/bin/port. Please check in your system, where the port is installed.

«

»