How to upload sketch to Arduino without needing IDE and seeing the program

If i where to create a product to sell to the mass market using a custom arduino compatible PCB, and needed to update the firmware (Arduino Sketch) to the board, how would i be able to release an update package for the user to download, and update to the board by plugging the boards USB port into their computer, and have it update without the user being able to access my program, or without them needing to use the arduino IDE? Say for MAC OS if i had a .dmg installer package that would send serial commands to all the ports and my board would reply back, allowing the software to know which serial port to use. I would then want to software to upload the code (and compile it) to the board. Sorry if this is a jumbled mess of words i'm having trouble expressing my needs and question.

It is possible to compile your program to a hex file and then the user can upload the hex file with a hex-uploader program. The user won't have access to the source code.

Sorry, I can't recall the fine details.


The part of the IDE that performs the upload is a program called avrdude. If you set file -> preferences -> show verbose output during upload, you will see the avrdude command that is used.

You can find the location of the hex file if you set file -> preferences -> show verbose output during compilation and check the output.

I don't know how one combines the two in some form of installer.

Maybe a ZIP that includes avrdude and the hex file and a batch file.
Unzip the ZIP and tell the user to run the batch file.
Don't know if batch files still work in the days of Windows 10.