Archive for May, 2022

Homebrew: wxWidgets static linking

by on May.01, 2022, under News

When building applications on macOS using wxWidgets the libraries are usually linked dynamically which makes the target executable a lot smaller. The downside, however, is that wxWidgets must be installed manually on any system our application is being deployed to (otherwise the application will crash due to missing symbols).

Compiling wxwidgets for static linkin

We’ll now tell Homebrew to compile for static linking.

brew edit wxwidgets

Scroll down to the part reading

def install
args = [ 
    # This is the default option, but be explicit

Append the following line to the end of this instruction:


Now reinstall wxwidgets but add the build-from-source flag:

brew reinstall –build-from-source wxwidgets

If we build an application now the binary size will be much larger (typically several megabytes) but the application will be portable at the same time.

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!