How to make a Mac (Macbook Pro) not hibernate?

This behavior is documented by Apple at Mac computers: Progress bar appears after waking from sleep:

With the release of the OS X Mountain Lion v10.8.2 supplemental update 2.0, a new feature was introduced to enter safe sleep after four hours of the computer being connected to AC power. This is an effort to comply with the European Energy Standards (ErP Lot6). This will only occur if there is no wireless or Ethernet activity and no activity from external devices such as USB storage devices.

This is normal behavior for the following units:

  • MacBook Pro (Mid 2012 and later)
  • MacBook Pro (Retina, Mid 2012 and later)
  • MacBook Air (Mid 2012 and later)
  • iMac (Late 2012 and later)
  • Mac mini (Late 2012 and later)

To disable this, turn autopoweroff in the sleep settings by running the following command in Terminal (under /Applications/Utilities):

sudo pmset -a autopoweroff 0  

The -a option disables auto poweroff for the Mac while on the charger as well as on battery. Use -c (instead of -a) to disable auto poweroff only when it's plugged in.