Run iTunes on Linux via Wine

Recent versions of Wine can run iTunes and Apple Music for Linux with no wizardry required.  Having been given a free Apple Music subscription as part of a family plan it’s useful to have additional streaming media options.  Below are the steps to use iTunes on Linux via Wine and have access to iTunes and Apple Music.

 

Install Wine
Ensure you have wine installed (>=3.10).  On Fedora 28 this is the current version as of typing this.  Earlier versions of Wine do not work so well but 3.10 seems ok.

dnf install wine winetricks

Configure OS Inside Wine Config
Next run the winecfg command and configure your operating system to Windows 7.

winecfg

Download iTunes for Windows 64bit
Next you’re going to download the Windows iTunes installer.

Run the Installer with Wine
Next you’re going to run the installer with wine and walk through all the confirmation steps.  I opted to not install a desktop icon so I have no idea what that will do.

You can either run wine against the .exe file or right-click and run it from your file manager.

After everything is installed you should see iTunes available in the application menu of your desktop environment.  Go ahead and run it.

Application Settings and Sound
From here you can safely log into iTunes with your Apple ID and everything should work.

Fix: Scratch Sounds in iTunes
If you experience scratchy sounds go into iTunes preferences and change the playback device to Direct Sound and restart the application.

Fix: Static and Crackling in Fedora 28+ in General
Recent Linux distributions using PulseAudio have changed to a time-based scheduler in stead of interrupt-driven. This may cause static and popping on older hardware. I noticed after upgrading to Fedora 28 that I started hearing crackling in the headset, I was able to fix this by editing /etc/pulse/default.pa

Change this:

load-module module-udev-detect

To this:

load-module module-udev-detect tsched=0

Then restart PulseAudio as your normal user:

pulseaudio -k
pulseaudio --start

Note that some applications may need to be restarted on Linux to take effect but this solved all the general scratchiness issues I had in general (mumble, bluejeans, etc).

Syncing Devices and Music Library
I have not gotten an iPhone detected and synced through iTunes running via Wine, I tried briefly to pass-through an iPhone via the USB dev device but but didn’t spend too much time on it.  Winecfg has the ability to map “drives” which correspond to hardware storage devices on the system.

[81085.354682] usb 2-3.2: Product: iPhone
[81085.354684] usb 2-3.2: Manufacturer: Apple Inc

If anyone has any luck here please post in the comments.

You do have access to your music library and can sync previous purchases down locally but I haven’t used this much past occasionally using the Apple Music streaming.

UPDATE: Correcting the Black Screen Issue with Wine
Folks in comments have noted that recent versions of wine may render some wine applications with a black screen.  I’ve only had this issue on Intel-based integrated GPUs but have found that you can work around it calling Wine commands through the excellent Lutris game manager/launcher.

I believe this somewhat has to do with the move to DXVK for handling DirecX11 calls with Wine and recent Win32/Win64 applications.

Lutris is just a useful way to launch any Wine-based application, though it’s original purpose is to support Gaming on Linux with Vulkan / DXVK.

Install Lutris
First you’ll want to install the Lutris game manager, refer to your distribution package manager to do this on another distribution.

dnf install lutris

Setup Lutris to Launch iTunes via Wine
Now you need to associate iTunes (or anything else) with Lutris, this can be done in a few steps.

Configure Wine Options

Enable DXVK in the Wine Setting

Save and click on Add Game

Now navigate to where iTunes.exe is located and associate it as a new game.

You’ll also want to set your Wine prefix to where you store and run your Wine applications, for me this is ~/.wine

When all is done, save and you should see a launchable entry for iTunes on the Lutris main menu.

After launching iTunes by right-clicking to “Play” or simply pushing the Play button when iTunes is highlighted it should launch for you.

Workaround for Installing iTunes via Wine
Some folks have noted they cannot even use wine to install 64bit iTunes to begin with, much less use Wine to launch it.  In these cases you can use Lutris to install iTunes by creating an entry just for the Win64 installer EXE.

You should just add the iTunes64Setup.exe as a normal game (name it something like itunes-setup).  It should be able to pull off the install for you.  Then, you can associate a permanent, real iTunes application entry in Lutris (pointing it to the installed iTunes.exe) following the screenshots above and you can safely remove the installation-only entry from the Lutris library.

Better Media and Streaming Options
Apple Music is good for playing specific artists or songs but I prefer other solutions for streaming (that mixes together related music based on an artist).

iTunes as just a media player is like using WinAmp with DRM and playlist functionality.  It is just really not a good media player when there are so many native choices like Amarok or Rhythmbox available for the Linux desktop.  If you’ve already curated an extensive iTunes library or playlist then running it in Linux may be useful for you.

For streaming I think Pithos is hard to beat, it serves as a front-end to Pandora and also doesn’t stop or display ads when I’ve used it.  I do not have a Pandora subscription.  It supports using an HTTP proxy like tinyproxy to stream through a remote host avoiding country restrictions if you are travelling.  I include Apple music in my choice sometimes just to have variety.

About Will Foster

hobo devop/sysadmin/SRE
This entry was posted in open source, sysadmin and tagged , , , , , , , , . Bookmark the permalink.

36 Responses to Run iTunes on Linux via Wine

  1. Ben England says:

    Thanks for letting me run iTunes on Linux for the very first time. However, when I brought up a browser while music was playing, itunes audio output started getting really scratchy and intermittent, almost like an old AM radio. I had to restart iTunes. Doesn’t inspire a lot of confidence in Wine. Why Windows Version = Windows 7? That is ancient, pre-dates XP doesn’t it?

    Like

    • Will Foster says:

      Hey @Ben, Windows 7 (released in 2009) was a few versions after Windows XP. Did you try switching to direct sound in the iTunes application (guide was updated with screenshots) that fixed it for me. In Wine generally setting Windows 7 works for just about everything as XP is so old some applications complain about it.

      Also on Fedora 28 I noticed that PulseAudio now uses a time-based scheduler, on my older desktop it had issues with scratchiness on some applications outside of iTunes so I changed my /etc/pulse/default.pa (see post I just updated it).

      Like

  2. jelabarre59 says:

    If you’re wondering, the reason to have iTunes on Linux is for buying music from the iTunes store. I don’t bother with the client for playing music, but until such time as they make a web-based store, or an Android client (because you know they’ll never port to Linux) I’d need the application just for the store. Don’t like the Amazon or Google music stores (and they probably have even less of what I want than iTunes).

    Like

  3. isalirezag says:

    Thank you for your post…
    when i click on itunes.exe and choose open with wine windows program loader nothing happens… any suggestion?

    Like

    • Will Foster says:

      What happens if you open a terminal where it’s located and run “wine itunes.exe”?

      I assume you’re also using the 64bit version of iTunes, you have winetricks installed and you’ve ran winecfg prior to set OS to Windows 7?

      Like

  4. GRB says:

    On KDE the itunes window is mostly black. You can read a few words but not much. ANy solution?

    Like

    • Gianluca Cherubini says:

      Same problem on Fedora 30. In addition, I cannot find how to launch it!

      Like

      • Still works fine for me on Fedora30 (desktop, Nvidia GPU). For me, once installed it gave itself a launcher in my desktop environment (XFCE).

        This is in the form of a .desktop FreeDesktop.org file:

        cat .local/share/applications/wine/Programs/iTunes/iTunes.desktop

        [Desktop Entry]
        Name=iTunes
        Exec=env WINEPREFIX="/home/wfoster/.wine" /usr/bin/wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/wfoster/.wine/dosdevices/c:/users/wfoster/Start\\ Menu/Programs/iTunes/iTunes.lnk
        Type=Application
        StartupNotify=true
        Comment=iTunes
        Icon=5D61_iTunes.0
        StartupWMClass=itunes.exe

        If it didn’t create a launcher for you can make a .desktop entry for it probably and place it in to .local/share/applications/ but I would try running it in a terminal via wine itunes.exe first to make sure it will work. Probably your .desktop entry can call this directly instead of the crazy program launcher above it made for me via wine installation.

        The black screen might be something with your GPU? Are you using an Intel integrated GPU? Are you using Wayland or Xorg?

        Like

      • Thanks Will! I’ll manage the launcher file.

        About the black screen: I really have no clue. I have a cheap Dell Laptop, I will try to find it out.

        Gianluca

        Like

      • Gianluca Cherubini says:

        Hello Will! Thanks for your reply! I will try that!

        About the black screen, this is my graphic card (I have a Dell Inspiron -cheap- laptop):
        gio mag 23 09:58:10 gianluca@inspiron:~$ lspci | grep VGA
        00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 605 (rev 03)

        Should I try some update/upgrade?

        Thank you soooooooo much.

        Like

      • Will Foster says:

        I’ve got a Lenovo x270 that probably has the same GPU chipset but I haven’t tried iTunes via wine on it since updating to Fedora30. Let me see if I get the same issue with black screen others mentioned here.

        They should all have a variant of the i915 chipset.

        Like

      • Gianluca Cherubini says:

        Thanks mate, God bless you.

        Like

      • Will Foster says:

        Gianluca, please see the blog post now and the updated parts around using Lutris to launch iTunes and/or also install it. This works for me and solves the black screen issue on Intel integrated GPU and later versions of wine.

        Like

  5. Sahnal Layyin says:

    Can you explain how to sync iPhone
    [81085.354682] usb 2-3.2: Product: iPhone
    [81085.354684] usb 2-3.2: Manufacturer: Apple Inc
    I dont get it

    Like

  6. spilkarblog says:

    i need help on the iphone sync too..
    anyone?

    Like

  7. Louis Uhls says:

    I can’t get itunes to launch either. it acts like it will run and then just stops. I have Itunes in my Downloads directory. What am I missing?

    Like

    • Will Foster says:

      What happens when you try to run it in a terminal via wine manually (instead of via any generated shortcut or .desktop entry). Can you pastebin what you get back?

      Like

      • Louis Uhls says:

        I have not tried running it in Terminal How do I do that? I’m not even sure where it installed it. I think part of the problem is I have installed it so many times that it’s been installed in different places. Sorry a bit of a Linux noob here, I know just enough Linux to get myself in trouble……Like now. :) I am running POP-OS by the way the latest version. Thanks for the reply.

        Like

      • Will Foster says:

        I think PoP OS is Debian-based?

        Try to use the locate command to find where the iTunes.exe is located and you can navigate to there and run it with the wine command.

        (don’t quote me on this)

        apt-get install mlocate && updatedb && locate *.exe | grep -i itunes

        ^ That should install mlocate, update the database and find any executables on your system with the name itunes.

        You should open a terminal and run it manually via wine /path/to/executable

        For me, this was in /home/myuser/.wine/drive_c/Program Files/iTunes/iTunes.exe

        Running things in a terminal will give you all the debug and background stuff that happens – often times this helps you figure out what’s going wrong.

        Like

  8. Louis Uhls says:

    Hello again Will. Sorry it took me so long to get back to you. When I try to install Itunes through the terminal I get this error message: wine iTunes64Setup.exe
    0030:err:msi:custom_get_thread_return Invalid Return Code 1
    0030:err:msi:ITERATE_Actions Execution halted, action L”InstallPackages” returned 1603
    louisuhls@pop-os:~/Downloads$. If I right click on Itunes64Setup.exe and select “open with a wine application” it just thinks about doing something and then stops.

    Like

    • Will Foster says:

      Hey Louis, see the updates at the bottom of this guide with using Lutris – using that to launch install iTunes might work for you. Then, you can try running it directly from Wine or via Lutris as well (screenshots above that).

      Like

  9. Will Foster says:

    Update here folks, if you’re having the black screen issue with wine and recent versions (4.12.x for me, seems to happen only on Intel-based integrated GPU) then see the instructions updated in this blog post about using Lutris to launch iTunes instead of wine directly. Hope this helps.

    Like

    • Gianluca Cherubini says:

      Thank you Will! I will! (pun unintended)

      Like

    • Martin says:

      I’m having the black screen problem, but with an AMD (Advanced Micro Devices, Inc. [AMD/ATI] Caicos XT [Radeon HD 7470/8470 / R5 235/310 OEM] (prog-if 00 [VGA controller])) card on Linux Mint.

      Like

  10. Marcel says:

    Will,
    thank you for this post. I’ve installed the current iTunes via playonlinux. Worked fine. But when I start, the background is black and I can only see some parts of text. So, I tried the workaround with lutris, but nothing changed. I’ve tired different Wine versions (including staging), But still, the iTunes window is almost totally black. Even the new 5.0 version of wine did not help.
    Any ideas?

    Like

  11. Name says:

    Doesn’t work:
    wine: Unhandled page fault on read access to 0000000000000010 at address 0000000140333389 (thread 0580), starting debugger…

    Like

  12. dyllos says:

    Lutris package cannot be found on Mint??

    hp@hp-Laptop-14:~$ sudo apt install lutris
    [sudo] password for hp:
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package lutris
    hp@hp-Laptop-14:~$

    I have itunes with black everywhere…

    Like

  13. Louis Uhls says:

    Well, I am back again. I tried installing Itunes again on Manjaro. I now get the black screen and it hard locks up on me. I am using an Nvidia RTX 2070. I also tried installing it through Lutris with no luck.

    Like

  14. PandaKing says:

    Hello, thanks a lot for the tutorial. I just ran into a rather troubling issue, being that iTunes keeps trying and failing to load my library. Anything I can do about that?

    Like

Have a Squat, Leave a Reply ..

This site uses Akismet to reduce spam. Learn how your comment data is processed.