The following should work on LyX >= 2.3.1 for all operating systems:
First go to
Tools > Preferences > Output and change "Overwrite on export" to "All files". Make sure you know what that means and that you are comfortable with that.
Apply that preference change.
Then go to
Help > About to find out where your "Library directory" and "User directory" are. For example, mine are
Navigate (e.g. in your file browser) to your library directory and go to the
ui folder and copy
stdtoolbars.inc to the
ui folder of your user directory. So in my case I copied
stdtoolbars.inc in your user directory:
You want to edit the line below
Toolbar "view/update" "View/Update"
Item "View" "buffer-view"
Item "View" "command-sequence buffer-view pdf2; buffer-export pdf2"
If you want to know more, read the
LyX help guides in the
Help menu for more customization.