Skip to content

Instantly share code, notes, and snippets.

@ddribin
Last active January 21, 2021 15:03
Show Gist options
  • Save ddribin/c3aff5179fe68e4cc7ddc768ef260f33 to your computer and use it in GitHub Desktop.
Save ddribin/c3aff5179fe68e4cc7ddc768ef260f33 to your computer and use it in GitHub Desktop.
A script to fake out Homebrew thinking gcc-5 is installed.
#!/bin/sh
if [ "$1" = "--version" ]; then
echo 'gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609'
exit 0
fi
exit 1
@ddribin
Copy link
Author

ddribin commented Jan 20, 2021

Copy this to /usr/bin/gcc and then Homebrew thinks gcc is installed and won't ask to install it. This is useful when installing only bottles or formula that do not need compilation. Without this, installing a formula shows this error:

Error: An exception occurred within a child process:
  CompilerSelectionError: <formula> cannot be built with any available compilers.
Install Clang or run `brew install gcc`.

Installing a compiler on a Linux server is not always desirable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment