How to install local .dmg files via homebrew?

I think there are a couple of issues here. Homebrew is a package manager for command line utilities. Homebrew packages are not in .dmg files.

There is a a related project called homebrew-cask (HBC) that functions as a package manager for GUI apps, the likes of which may indeed be distributed via .dmg file.

Presuming that you are trying to use cask to install a GUI app distributed in a dmg file, you must understand that the point of a package manager like homebrew-cask (HBC) is that you create or are provided with a script that informs the package manager how to install and manage the software. All DMGs are not innately compatible with HBC.

You can learn about how this works from the guide on contributing to HBC: https://github.com/caskroom/homebrew-cask/blob/master/CONTRIBUTING.md

The short version is that in order to manage a package with HBC, you need to write a "cask", which is a ruby file that gives the package manager a concept of what the package is.

That said, presume that you are trying to install an existing cask, but use a local .dmg file to avoid having to redownload it? I believe Cask will maintain its own download cache, and so theoretically, if your dmg file matches the sha256 hash contained in the cask and you place that dmg in the cache location, cask should be able to install from it without redownloading.

That's as far as I can go right now, so hopefully this helps.