Skip to content

Error "undefined method by_macos?'" when running brew link` #7339

@waldyrious

Description

@waldyrious
  • ran brew update and can still reproduce the problem?
  • ran brew doctor, fixed all issues and can still reproduce the problem?
  • ran brew config and brew doctor and included their output with your issue?

What you were trying to do (and why)

I was trying to link brewed gettext to be able to compile the fntsample project. I installed all the dependencies listed in the project's README with Homebrew, but when I tried to configure it with the cmake command, I got the following error

CMake Error at /usr/local/Cellar/cmake/3.17.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
  Failed to find Gettext libintl (missing: Intl_INCLUDE_DIR)

To make gettext findable by CMake, I ran

brew link --force gettext

as was suggested in this comment which I found while searching for the CMake error message.

What happened (include command output)

I got the following error:

Command output
$ brew link --force gettext
Error: undefined method `by_macos?' for :shadowed_by_macos:Symbol
Please report this issue:
  https://docs.brew.sh/Troubleshooting
/usr/local/Homebrew/Library/Homebrew/cmd/link.rb:71:in `block in link'
/usr/local/Homebrew/Library/Homebrew/cmd/link.rb:40:in `each'
/usr/local/Homebrew/Library/Homebrew/cmd/link.rb:40:in `link'
/usr/local/Homebrew/Library/Homebrew/brew.rb:110:in `
  

What you expected to happen

I expected the brewed gettext to be linked in /usr/local.

Step-by-step reproduction instructions (by running brew commands)

$ brew install gettext
$ brew link --force gettext

Output of brew config and brew doctor commands

$ brew config
HOMEBREW_VERSION: 2.2.12-56-g793407a
ORIGIN: https://github.com/Homebrew/brew
HEAD: 793407a2e080980636c3ec274429cff2e345672b
Last commit: 7 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: b86189eea34842c3867d3b5462a388536beb7be8
Core tap last commit: 9 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_BROWSER: open
HOMEBREW_EDITOR: micro
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_MAKE_JOBS: 8
CPU: octa-core 64-bit kabylake
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
Clang: 11.0 build 1103
Git: 2.26.0 => /usr/local/bin/git
Curl: 7.64.1 => /usr/bin/curl
Java: 14
macOS: 10.15.3-x86_64
CLT: 11.4.0.0.1.1583798712
Xcode: N/A
$ brew doctor
Your system is ready to brew.

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedPR was locked due to age

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions