iTunes shows 'ghost' songs on my iPhone that are not there, how do I fix this? When I go the Music app on my iPhone it shows the 'No Content' screen (see screenshot below). This is because I purposely deleted all music from the device (through Settings > General > Usage > Music > Edit > All Music > Delete).



I also deleted all songs (about 250) from my iTunes library on my Mac (moved to trash). I can re-download them because all songs have been purchased from the iTunes store.

When I connect the device to my Mac and select the device's Music list, it shows 7 songs, with a grayed out text color, and with a circle icon with dashed outline next to each song.

The device itself does not show these songs.

When I set the device to 'Manually manage music and videos' I can delete the 'ghost' songs from the device's Music list. But after I reconnect the device the ghost songs are again visible in its Music list in iTunes...

How can I permanently get rid of these 'ghost' songs listed on my device only in iTunes?



Here's what I've tried so far:


Toggled the 'Show iTunes in the Cloud purchases' option in iTunes. On or off doesn't seem to affect the Music list for a connected device.
Turned off the 'Show All Music' option in the Music app's settings.
Reset all content and settings on the iPhone, then restoring from the device's iCloud back-up. 


This did not lead to any visible change.


Re-downloading said songs from the iTunes Store to the iTunes Library on my Mac, then synchronizing with the device. 


The result was that 3 out of 7 songs were no longer grayed out, i.e. 'replaced' by their actual downloads, and playable on the device. The other 4 songs were now listed twice, one grayed out and the other the actual downloaded song, present and playable on the device.


Deleting all 7 songs from the iTunes library (moved to trash). 


I was hoping that would get rid of the 3 songs that seemed 'fixed' in step 2 above, but in fact it reverted back to the old situation, with 7 songs listed in a grayed out font.


Downloaded the songs directly to the device using the iTunes Store app (via More > Purchased > Music). 


This resulted in duplicate entries for all songs (not just the 4 songs like in step 2 above) in the device's Music list in iTunes. Synchronizing the device did not transfer the downloaded songs to the iTunes library.


Reset Sync Service on my Mac (defaults delete com.apple.SyncServer SyncServicesResetWorldRunOnce, followed by a reboot)
Deleted iTunes Library Extras.itdb, iTunes Library Genius.itdb, all 'Previous iTunes Libraries' and all 'Album Artwork' from ~/Library/Application Support/iTunes.
Removed *.localstorage and StorageTracker.db from ~/Library/iTunes.
Ran the List MIAs v3.3 and Super Remove Dead Tracks v4.0 applications with iTunes open and the device connected (no missing files or dead tracks reported)
Signed out of the iTunes &amp; App Store on the device (and signed back in).




I use iTunes 11.3.1 (2) on OS X Mavericks 10.9.4, in combination with an iPhone 5S running iOS 7.1.2. All software is up to date.



There is a cottage industry of apps to help people deal with iTunes' incoherent and inconsistent behavior. I have not tried any of those apps, and they pollute the Google results, making it hard to find an actual solution. I suspect my problem can be fixed with Apple Script, but have no idea where to start.
I had exactly the same issue, it's commonly called "ghost songs" and it still exists in iOS 10.x There was no way to remove these songs using iTunes (I could deleted them there but on next sync they were just back) or any delete function on the phone itself (I deleted all music on the phone, but iTunes kept showing the ghost songs while the phone said there are no songs on the phone).

Here is how I was able to fix it:


Be sure to have a restorable backup of your iPhone content!
Download iFunbox
Kill the Music App on your iPhone
Connect your iPhone to your computer
Make sure iTunes is not running
Start iFunbox
Choose Raw File System
Delete the following files and folders:


Downloads
iTunes Control &gt; Sync &gt; Media
iTunes Control &gt; Music
iTunes Control &gt; iTunes &gt; MediaLibrary.sqlitedb
iTunes Control &gt; iTunes &gt; MediaLibrary.sqlitedb-shm
iTunes Control &gt; iTunes &gt; MediaLibrary.sqlitedb-wal

Unplug your iPhone
Reboot it the hard way: Press&amp;hold Home+Start button > 5 sec
 (do not power it off the normal way, which is pressing just Start button > 5 sec and then using the slider to power it off. I did that at first and then the ghost songs came back!)
Once rebooted, connect to your computer.
Open iTunes
Check all your sync settings are still set correctly
Sync


After that the ghost songs were gone.