In the Preferences of the Arduino IDE; after Show verbose output during:
check the box next to compilation
.
Then when you compile you should get something like this at the bottom of the window:
...
...
"/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-objcopy" -O ihex -R .eeprom "/var/folders/tp/grrlc56j3z7057f12_7f1_0r0000gn/T/arduino_build_635063/Blink.ino.elf" "/var/folders/tp/grrlc56j3z7057f12_7f1_0r0000gn/T/arduino_build_635063/Blink.ino.hex"
Sketch uses 928 bytes (3%) of program storage space. Maximum is 30720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
At the end of the third line from the bottom you get the .hex
filename. In this case (on OSX) that would be /var/folders/tp/grrlc56j3z7057f12_7f1_0r0000gn/T/arduino_build_635063/Blink.ino.hex
preferences.txt
file and add the linebuild.path=<folder for build output>
, specifying an existing folder to send the build artifacts to. Your hex files will be in there the next check/build you run.