# How to remove the “Could not connect to the iTunes store” error message when your network does not allow access to the iTunes Store

Since the last update, iTunes is unusable for me on my iMac, because with every song change it shows a "Could not connect to the iTunes Store" error message. My network at work does not allow access to the iTunes store, but that is ok. I just want to listen to my local music connection there. I have disabled the iTunes Store in the parental settings completely, but still, the error pops up with each and every song change. Any idea how to prevent iTunes from showing this popup?

There are two major annoyances here in iTunes imho a) iTunes tries to access the store even if it is disabled completely in the settings and you're signed out b) The error messages "staple" on top of each other, so iTunes diplays the same error 1000 times and you have to click them all away. This reminds me of Windows 95 times.

• I use Little Snitch to block outgoing connections if I don't want to access the iTunes Store, and get the same error messages. It used to be sufficient to sign out, but since the last update this no longer does the trick. – Christian David Dec 20 '16 at 15:48
• I am referring to iTunes version 12.5.4.42, running on OS X 10.11.6. – Christian David Dec 20 '16 at 16:07
• Exactly the same here, 12.5.4.42 running OSX 10.11.6, and signing out used to do the trick but does no more. The windows popping up in the background even cause typo errors sometimes on my system when I use programs under X11 when they appear. Very nasty, if i don't find a fix i'll have to remove iTunes and switch to another program. :/ – user2707001 Dec 20 '16 at 18:07
• Signing out of iTunes used to to the deal. I have tried to sign out of both the App Store and iCloud... maybe this has to do with still being signed in to iTunes? Can i programmatically sign out or something like that? I can't believe there is no solution to this. In any case, "stapling" the same error message for 100 times is really bad code from Apple. I'm not used to that :/ – user2707001 Dec 22 '16 at 10:08
• Same here, running iTunes 12.5.4.42 on OS X 10.9.5 (because I could not find anything of interest in any of the next releases of "macOS"). I cannot believe I'm looking at alternatives right now. – Fr. Dec 25 '16 at 0:31

I traced the problem down to a TLS handshake (thanks to jonnydigitol below for the idea!) and a total of 63 packets between the host and 23.211.148.217, which is init.iTunes.apple.com - that is executed when iTunes is started. Once this handshake completes, all is fine and you can use iTunes. But you must tunnel traffic to this host on startup, otherwise you get the error with each and every song change as iTunes tries and tries to connect to init.iTunes and throws an error popup.

Consider the answer below by jonnydigitol - you can connect by mobile phone internet or a tunnel to init.iTunes.apple.com, start iTunes and never ever turn it off - then it keeps working without an internet connection "infinitely".

How to really 'fix' the issue by installing your own web server on localhost that answers the ping:

(Check that your iTunes is up to date, there might be a fix out already)

Open Applications->Utilities->Terminal and enter the following lines

If you do not have homebrew installed, first do this :

/usr/bin/ruby -e "\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


Make sure openssl and node.js are installed

brew install openssl node wget


To redirect init.apple.itunes.com to local

echo '127.0.0.1 init.iTunes.apple.com' | sudo tee -a /etc/hosts


openssl genrsa -out rootCA.key 2048
openssl genrsa -des3 -out rootCA.key 2048


Enter any pass phrase you like

openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.pem


Enter your pass phrase. Leave all lines empty except

Common Name (e.g. server FQDN or YOUR name) []:init.itunes.apple.com

And the same thing once more (same passphrase, same common name)

sudo security add-trusted-cert -d -r trustRoot -k "/Library/Keychains/System.keychain" rootCA.pem
openssl genrsa -out device.key 2048
openssl req -new -key device.key -out device.csr
openssl x509 -req -in device.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out device.crt -days 500 -sha256
sudo security add-trusted-cert -d -r trustRoot -k "/Library/Keychains/System.keychain" device.crt


Note response and start your own https server that takes the ping

wget -O response.xml "https://itunes.apple.com/WebObjects/MZStore.woa/wa/initiateSession?ix=1"
echo "var t=require('tls');var f=require('fs');var xmlresp = f.readFileSync('response.xml');var options = {key:f.readFileSync('device.key'),cert:f.readFileSync('device.crt')};var server=t.createServer(options, function (request,response) {request.on('data', function (chunk) {request.write(xmlresp);});});server.listen(443, function() {});" > ims.js
sudo node ims.js


Leave terminal open or minimize it, open Safari

If you get a trust certificate warning, change the policy to "always trust". If the page loads infintely, everything is fine.

Open iTunes. The error should be gone.

For the future, if you want to use iTunes, open a Terminal and run

sudo node ims.js


Then start iTunes.

Alternatively, revert to an older version.

I had given up on the issue, submitted a bug report to Apple, and, after hearing nothing from them, rolled back to the previous iTunes and rebuild by complete library in an hour long effort. Everything works now again, but I'm really disappointed by Apple here. I'm not (yet) used to them releasing such bad code.

The only way out for me was to use Pacifist to unpack an older iTunes pkg which I downloaded from Apple and extract the App, and then rebuild the complete iTunes library (which is HUGE). This is a kind of hacking I got used to being necessary on Windows systems sometimes, but i cannot remember I had to do such a thing on OSX ever. Until now. What's next, disassemble?

Apple, you have a software quality problem. Just my 2 cents.

News - Apple has processed my bug report and assigned it status "duplicate of 29741441 (OPEN)".

• I'm using iTunes 10.4.1 under Mac OS 10.12.3. 10.4.1 was the last version that gives absolutely no trouble when network is not available. I keep a copy of iTunes 12.5.5.5 around too, for those times when I need to synch with a new device, or use the store. As far as I'm concerned, Apple has no need to know what I am listening to. – Wayfaring Stranger Jan 26 '17 at 17:01
• Well - if you use the code I posted above, Apple won't get noticed anymore.. iTunes will be calling your local webserver instead. So, if you don't want to tell Apple and still use iTunes - go ahead. Just make sure to remove the redirect from /etc/hosts if you want to call Apple again. Definitely better than multiple iTunes versions imho. – user2707001 Feb 5 '17 at 0:14
• At user2707001 -> That's a really nice bit of coding you've shown above, but I hate the cutesy look of iTunes 12, the lack of multiple windows, or large album graphics, the problems getting filters to work sensibly, the play que, etc. etc. etc. I'm just better off using an older version, and switching to new only when absolutely needed. As I said, you've got an elegant answer here. It's just not for everyone. – Wayfaring Stranger Feb 5 '17 at 2:24
• iTunes 12.4.3.1 on MacOS 10.12.6 complained about the connection to the iTunes Store being insecure (even after I added the root CA and accepted it in Safari) but neither error message came back after I accepted that insecure connection one, even after I shut down the HTTP server. – Blender Aug 20 '17 at 5:25

Similar issue since the update. Seems to happen only while listening to iTunes offline. Alas, I may have found a solution (for me at least). Connect your computer to your phone's personal WiFi (I chose USB connect), play a song and voila! No more error! Afterward, I turned off the hotspot (optional) and to my surprise— still no error. Hope this works!

• I awarded the 50 bounty to this answer because it brings something new. If you use a SSL tunnel or your smartphone to EVER connect to iTunes, you can use it afterwards until you reboot. This is at least a valid observation and a workable way out, although it's really ugly. The network security guys will kill me if I do this at work, but for some people it might be a way out. Just connect once, then disconnect and iTunes is usable -.- – user2707001 Dec 30 '16 at 16:06
• I have just tested this answer. Re-installed new iTunes and my "real" library as I hated the "rebuilt" one. Set up an SSL tunnel to my external server, started iTunes, played a song, turned of the SSL tunnel. It works flawlessly from them (with disabled iTunes store in the preferences). I can work with this but its REALLY AWFUL. I will capture the traffic/requests and try to find a workaround based on this answer maybe, but I still hope Apple will fix this.... in vain? – user2707001 Dec 30 '16 at 16:20
• This worked fantastic for me. Turned wifi off on the laptop after connecting to personal hotspot and the problem has not returned – heathobrien Jan 24 '17 at 10:43

This is my set up, please notice that I don't have check marks in the download options in the screenshots.

If you have the check marks, you can try to remove them, and see if it doesn't work.

• This leads nowhere. As I wrote, I have disabled the iTunes store completely in the "Restrictions" section already. Then, these dialogs are all disabled and grayed out anyway so you cannot select anything. – user2707001 Dec 30 '16 at 16:14
• And the grayed out boxes are not selected ?? - if they was selected before you in "Restrictions" disabled iTunes, then iTunes might still trying to sync with the Store - but this is just a guess from me, because the disabling just disable iTunes for the user - not iTunes it self. – Rene Larsen Dec 30 '16 at 16:20
• Nope, they are all deselected and I am not signed in either. Plus, no network connection at all in the test setup. – user2707001 Dec 30 '16 at 16:25

One way to solve this is go back to a previous version of itunes but many people here have a problem accessing their old libraries.

I might have a solution to do that and it involves editing a new version of your library.xml - which is not that hard if you have program to do that. Text Wrangler is still free AFAIK and would do the job, but there might be others. I have no favorites in this. I do not think text edit would be ok for this since it might not save it in the original format.

1. Before removing itunes you open it one more time and choose File > Library > export Library (NOT export Playlist!!!)
2. Itunes will then export your library as a library.xml. There is also one in your user folder:Music:iTunes - but that one might be old.
3. you can now remove your itunes program and install another version (link below). Also remove the library files from your user folder:Music:iTunes - simply everything that starts with 'itunes library' but leave the rest, like folders and what is in them. If you can not delete itunes - I will explain that below
4. Open your freshly made library.xml - mind you this could be a large file if you have many playlists.
5. Find the line with your itunes version number. With me that is line 8 and it reads like <key>Application Version</key><string>12.5.4.42</string>
6. Go to the freshly installed itumes program in the finder, select it, press comand + I to open the info about the program and find the long version number. In my case I installed itunes 12.4.3, and that is what you see at the version, but you find the long number in the copyright info and in my case it says '12.4.3.1'. Now replace 12.5.4.42 with the number from your current itunes version.
7. Press save
8. Open up your new old itunes install and check if all your preferences are still the same - for instance the stuff in the advanced tab (copy files to itunes library and keep it organized) was not as it was before.
9. Now go to File > Library > import Playlist (yes this makes no sense, but just do it) and import your edited library.xml. Wait. If you have a big library, wait some more. If it is a large library, be prepared to wait even longer.

Your playlist, folders, songs, playcounts and ratings will be there, but your loves and dislikes not. All your listings will be reset to 'Playlist'

Now as prommised: removing itunes from your applications folder. If you want to drop it in the trash or use command + backspace the finder will tell you iTunes is important operating system software and you can not delete it.

• Select iTunes
• Press command + i
• You see the information window. At the bottom it says 'Sharing & Permissions' - if that is closed open it by pressing the triangle.
• You see a tiny lock, press it and give in your password (assuming you have administrator rights)
• If your name is not there, press the + below the list with names. An address book will open and you can add your name or the name you use as a user of that computer. Set the rights of that name to 'Read and write
• You can now press the lock again to end the editing. Afterwards you can delete iTunes anyway you want, and you can install another version of iTunes.

• Not a bad idea, editing instead of rebuilding. Does "your" way keep the song ratings (stars etc.)? – user2707001 Jan 8 '17 at 15:30
• Stars are there - play counts as well - but the hearts are gone. there are also other things you can do with the library.xml. If you look further down into the file where the songs are you can see the location with name of the disk etc. You could move your complete library to another disk and re-import everything (except the hears of course) that way if you do a search and replace the right way – YuriGoul Jan 11 '17 at 11:22
• always keep a backup of the old file if you start to experiment – YuriGoul Jan 11 '17 at 11:28
• A sequence of your older libraries is stored in "Previous iTunes Libraries" inside the "iTunes Folder". To revert to an older version, just drag "iTunes Library 2015-09-11 5.itl", or whatever out to the main iTunes Library level, and rename it "iTunes Library.itl". Obviously you'll have to move the current "iTunes Library.itl" somewhere else first. Upon opening, iTunes will update the replaced .itl to whatever version of iTunes you happen to be running. – Wayfaring Stranger Jan 27 '17 at 15:05
• In my case this was not an option because the library was too old. – YuriGoul Jan 28 '17 at 17:05

Here is my solution (sorry for my bad English, I'm French)

1. Delete iTunes in "Applications" folder in finder : "Read Informations" on iTunes App, access read & write permission for everyone, and put iTunes in Trash.

4. Enjoy iTunes & wait for a fix update.

:)

• Well, the big problem with this is that I have to rebuild my iTunes Library as the "old" iTunes cannot open my "new" xml. This means that e.g. all my song rating are GONE. This was only like 50 hours of work to rate all the songs... -.-. Plus, it's very Microsoft to me to just roll back to an elder version because the new version has bugs so big you can neither fix them nor use the software anymore... – user2707001 Dec 30 '16 at 16:03
• I think more you use iTunes options, more you have problems. Few times ago I understood that I should less options possible if I want really a clean and secure iTunes. So I think you need do some concessions. – AnonymousBoss Dec 30 '16 at 16:32
• About the security i understand, but it's the only link i found to download mac version of iTunes in this version. – AnonymousBoss Dec 30 '16 at 16:33
• Thanks for the effort. It might be good to some people having this problem - just to me, it doesn't help that much. I have posted a link for an older version of iTunes above directly from Apple, but your version might be good for some who have no problems running from non-trusted sources. – user2707001 Dec 30 '16 at 16:41

The same thing was happening to me on my office PC and it just fixed itself, but unfortunately I didn't notice exactly when it actually happened. After about 5 songs I realized I wasn't getting the error anymore. My best guess is that the Genius results from pre-update Genius playlists might have been trying to check themselves between each song - even though I haven't played them in a month or so.

I was messing with a Smart playlist based on some Genius playlists that were carryovers from before I updated. I had deleted the older Genius playlists and made some new ones and I'm thinking that was when the errors stopped stacking up. Now I only get the error when I try to manually update the Genius results from File>Library>Update Genius, which is fine.

I can't re-create the problem now to test it, so hopefully you guys can tell me if I'm on to something or not. Sorry if this is a red herring. I was doing a lot of clicking around at the time.

• Will check if it has to do with the playlists – user2707001 Jan 3 '17 at 17:05

I had the same problem and subsequently downgraded to iTunes 12.4.3.1 (from Apple.com). Since then, no more annoying popups. I wasn't too bothered about scrapping my playlists, and am now revisiting parts of my library I completely forgot about.

This is an ugly shortcut, I agree, but it worked for me, I hope it does for you.

iTunes Preferences > General > Notifications: Uncheck "When song changes".

You can leave the rest of the store-related preferences as you wish, just kill the notifications. That did it for me.

• Is unchecked (and always was) and does not work. If I boot without network, start iTunes and press play, the error pops up. – user2707001 Jan 8 '17 at 18:09
• @user2707001 Yes, it might give you an error warning once or twice, when you do some network-related activity, but it killed the multiple pop-ups which were stacked on top of one another, making the app hard to use. – Lew Jan 12 '17 at 14:42
• nope, one popup with each and every song change with the checkbox unchecked – user2707001 Jan 12 '17 at 15:02

Signing into the store and Unchecking all options under the store removed this message for me.

• how do you sign into the store when you're offline...? – user2707001 Jan 16 '17 at 16:14

"Preferences > Restrictions > Disable: iTunes Store" I think is a temporary solution. But now nothing is connected T_T

• Biggest issue with this is that I have to enable parental controls. This is quite out of the question for my programming account. – user2707001 Dec 30 '16 at 16:07
• Meaning if I go to the system preferences. Going to Preferences>Restrictions>Disable iTunes store is what I did as I posted above. STILL, iTunes will pop up the error (!!!) – user2707001 Dec 30 '16 at 16:16

This worked for me: iTunes Preferences > General > Notifications: Uncheck "When song changes"

Now when I'm offline, I no longer get the horrible "could not connect to iTunes store" error after ever song.

• How does this improve on other answers here e.g. apple.stackexchange.com/a/267920/237 – user151019 Jan 15 '17 at 20:01
• Well… it did work for a while. Now the errors are back. (Worked until the next time I was online and then offline again.) How frustrating! – Dblatner Jan 16 '17 at 4:54

Use either built-in firewall or third-party firewall to block iTunes traffic. Some of the well known firewall apps for Mac are LittleSnitch and HandsOff.

It used to happen to me too until I blocked all iTunes connections from firewall.

• Thanks for your reply. I installed LittleSnitch and blocked all iTunes traffic (iTunes - deny any outgoing connection). The problem still persists, with EVERY song change, I get an error popup. Any idea? – user2707001 Dec 19 '16 at 14:58
• The worst thing is that these popups even "staple", so i have to click like 20 popups away when i listen to an hour of music in the background. WTF, Apple? – user2707001 Dec 19 '16 at 15:20
• @user2707001 try disabling all connections not just outgoing. It should work. In my case there was something wrong not just "Could not connect to iTunes Store", it takes a long time to startup, and it freezes. I had to block all connections then only the iTunes think macbook is offline and it was fine again. – Thu Yein Tun Dec 19 '16 at 22:43
• negative, this does not work. disabled ALL traffic to iTunes, incoming and outgoing, still the error popup persists on each and every song change. but i guess the idea is good, i will need to block another process/application and it should work. will try to wireshark it. – user2707001 Dec 20 '16 at 12:48
• actually, the error message even appears when i plug out the ethernet cable and disable wifi altogether – user2707001 Dec 20 '16 at 13:25

i used cleanmymac to reset itunes, then the error is gone. hope this continues.

• Really? This is weird... Please try to reboot without network connection, immediately play a song in iTunes and confirm it works. – user2707001 Jan 3 '17 at 17:00

## protected by TetsujinJan 16 '17 at 7:35

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).