How to install a .hex firmware?
A major part of the Arduino IDE is sort of semi-hidden, and that is some guy called  avrdude. Actually, AVRDUDE – AVR Downloader/UploaDEr is a standalone binary.

As an aside, there is also gcc which does the compiling, but that is another matter. The avrdude uploads the compiled binary provided by gcc on to the Arduino, via the USB port (COM port).

You can invoke this from the command line (assuming that you have the Arduino IDE installed).

You will need to specify (see command line option descriptions):


The baud rate of the COM port (-b)
The COM port (-P)
The processor used in the board (for the Arduino Mega2560 board: ATmega2560) (-p)
The path to the .hex file (-U)
The path to the .conf file of avrdude itself (-C)
Verbose mode, so see what is happening (-v)
Specify the programmer to be used (-c). See the -c option on command line option descriptions for more information.
Disable auto erase for flash (-D)


The command will be of the form:

&lt;path to arduino&gt;/hardware/tools/avr/bin/avrdude
-C&lt;path to arduino&gt;/hardware/tools/avr/etc/avrdude.conf
-v -patmega2560 -carduino -b 115200 -cstk500v2
-P&lt;name of serial port&gt;
-D -Uflash:w:&lt;path to hex file&gt;:i


This example above:


Specifies the full path to the avrdude binary
Specifies the full path to the avrdude .conf configuration file
Verbose mode
The ATmega2560 processor used in the Arduino Mega2560 board
The Arduino programmer
The baud rate of the USB port
The Atmel STK500 Version 2.x firmware programmer (may not be required)
The port to which the Arduino board is connected
Disables auto-flash as it is not required – Auto erase is not used for ATxmega devices as these devices can use page erase before writing each page so no explicit chip erase is required. Note however that any page not affected by the current operation will retain its previous contents.
The memory to be uploaded to and the path to the .hex file (see the -U option on command line option descriptions for more information):


flash specifies the flash ROM of the device.
w: read the specified file and write it to the specified device memory
:i specifies Intel Hex



Examples

For Windows

C:\dev\Arduino\hardware\tools\avr\bin\avrdude 
-CC:\dev\Arduino\hardware\tools\avr\etc\avrdude.conf 
-v -patmega2560 -carduino -b115200 -cstk500v2
-P\\.\COM1 
-D -Uflash:w:C:\Users\&lt;username&gt;\Documents\firmware.hex:i


For OSX

/Applications/Arduino/hardware/tools/avr/bin/avrdude 
-C/Applications/Arduino/hardware/tools/avr/etc/avrdude.conf -v -patmega2560 -carduino -b115200 -cstk500v2 -P\\.\COM1 -D -Uflash:w:/Users/&lt;username&gt;/Documents/Arduino/firmware.hex:i


Alternatives

If you are not comfortable using a command line interface (CLI) it might be easier to use a GUI solution…

XLoader

For a Windows only solution, see Uploading Arduino HEX files with XLoader



From the author’s website:


  I’ve made a small program that can be used to upload your own *.hex
  files to arduino boards using the bootloader. That means you don’t
  need a flash programmer. I made it for my own use and found it pretty
  useful. So now I’ve made a more user friendly version.. To use it
  compile you’re code in something like AvrStudio. Then simply start
  XLoader.exe, pick a hex file and press upload. That’s it. Good news it
  now also supports Arduino Uno.


Arduino Builder

From Arduino Builder – standalone utility for building and uploading Arduino sketches


  
  Choose file, either a sketch file (.ino), an HEX file (.hex) or an ELF file (.elf)
  Choose the board type in the dropdown list.
  Click on the serial port (or USBASP button) and theuploading will be proceeded.
  


Arduino Uploader

From the same page, there is Arduino Uploader which is a command line version of Arduino Builder.