You need to free up lots of hard drive space.
At a minimum, at least, 15 to 20 GBs of space.
Perhaps even more.
Hard drive full or near full:
You are going to have to delete, move or archive your data to regain hard drive space.
Have you emptied your iMac's Trash icon in the Dock?
If you use iPhoto, iPhoto has its own trash that needs to be emptied, also.
If you use Apple Mail app, Apple Mail also has its own trash area that needs to be emptied, too!
Other things you can do to gain space.
Delete any old or no longer needed emails and/or archive older emails you want to save.
Look through your Documents folder and delete any type of old useless type files like "Read Me" type files.
Again, archive or delete any old documents you no longer use or immediately need.
Uninstall apps that you no longer use. If the app has a dedicated uninstaller, use it to completely uninstall the app. If the app has no uninstaller, then just drag it to the OS X Trash icon and empty the Trash.
Download an app called OnyX for your version of OS X.
When you install and launch it, let it do its thing initially, then go to the cleaning and maintenance tabs and run all of the processes in the tabs. Let OnyX clean out all web browser cache files, web browser histories, system cache files, delete old error log files.
Typically, iTunes and iPhoto libraries are the biggest users of HD space.
If you have any other large folders of personal data or projects, these should be thinned out, moved, also, to the external hard drive and then either archived to disc and/or deleted off your internal hard drive.
You may have to Purchase an external FireWire or Thunderbolt hard drive to move these files/data off of your internal drive to the external hard drive and deleted off of the internal hard drive.
Good Luck!