Skip to content

Instantly share code, notes, and snippets.

@s3cur3
Last active February 14, 2022 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s3cur3/6e2b23d99077d19f685c8faadcf5d968 to your computer and use it in GitHub Desktop.
Save s3cur3/6e2b23d99077d19f685c8faadcf5d968 to your computer and use it in GitHub Desktop.
Install wxwidgets in a way Elixir/Erlang's :observer can use
# If you're here, I assume it's because you tried to run
# :observer for the first time on your Mac and discovered
# it won't work because of some obscure issue with wxwidgets
# (formerly known to Homebrew as wxmac).
#
# This script will fix it for you.
# 1. Remove the old and busted copy
brew uninstall wxwidgets --ignore-dependencies
# 2. Grab the path at which the Homebrew *formula* lives
formula_path="$(brew edit wxwidgets --print-path)"
# 3. Modify the compilation arguments list in the formula
# to add the --enable-compat28 flag.
# This flag is what Erlang's :observer needs.
# This will store the complete, edited text of the
# in fixed_formula.
fixed_formula=$(sed 's/args = \[/args = \["--enable-compat28",/' "$formula_path")
# 4. Write the corrected formula back to the path Homebrew
# will read it from.
echo "$fixed_formula" > "$formula_path"
# 5. Build it from source with the corrected formula.
brew install wxwidgets --build-from-source
# 6. Suggest next steps
echo "WARNING: While wxwidgets should now be fixed, you"
echo " will still need to reinstall Erlang."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment