This is a tough one but if you are patient and are willing to go through a series of steps then you can do it.
1st - you need to make sure when you connect your iPod to your iMac to make sure it does not automatically sync.
2nd - you need to search and launch Terminal in your iMac.
3rd - you need to copy and paste the following commands separately then hit return after each command:
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
4th - then double click your iPod icon on your desktop.
5th - find the iPod control folder
6th - find and open the music folder
7th - copy the music to a new folder somewhere on your desktop. name that folder something recognizable like 'Music From Recovered iPod'
8th - launch iTunes and copy the music into iTunes
9th - that's it! you've recovered your iPod music!!