While executing the following command:
brew install opencv
I am encountered with the following exception:
Error: gobject-introspection: uninitialized constant Language::Python::Shebang
Could you please help me find the root cause for this and resolve it?
Language::Python::Shebang is the replacement for Language::Python.rewrite_python_shebang, which was deprecated in Homebrew 2.3.0
So you are likely using a version of Homebrew prior to 2.3.0 You can check your Homebrew version with brew --version.
Just doing brew update should update Homebrew to the latest version.
If you at some point added or changed a formula and worked locally on it you could be on a feature branch or your Homebrew working directory is changed so it does not update the master branch.
In these cases try the following:
cd /usr/local/Homebrew
git status
Discard or git stash your changes or git checkout master if you are on a feature branch
Once the working directory is clean you can brew update to update Homebrew
Related
Followed this tutorial in installing qt5.5 on a macOS version 10.13.6 High Sierra. Failed when trying to brew install qt#5.5 giving me an error below:
Error: qt#5.5: unknown version :mountain_lion
Versions:
brew
Homebrew 2.0.0
Homebrew/homebrew-core (git revision 175af; last commit 2019-02-02)
Homebrew/homebrew-cask (git revision 05a81; last commit 2019-02-02)
macOS version 10.13.6 High Sierra
any help?
Referring to the tutorial, the following steps are executed to install qt#5.5
brew update
cd $( brew --prefix )/Homebrew/Library/Taps/homebrew/homebrew-core
# below is the last commit containing qt#5.5 with homebrew
git checkout 9ba3d6ef8891e5c15dbdc9333f857b13711d4e97 Formula/qt#5.5.rb
# here is where the error occurs
brew install qt#5.5
Solution
turns out line 25 of qt#5.5.rb formula file checked out in the command ( as seen in the referred tutorial)
git checkout 9ba3d6ef8891e5c15dbdc9333f857b13711d4e97 Formula/qt#5.5.rb
is causing this problem. commenting it out fixes the issue
I tried using
brew install yarn#1.7.0 --without-node
or
brew install yarn#1.7.x --without-node
But I get the following error
Error: No available formula with the name "yarn#1.7.0"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
I presume its possible to install different versions of yarn using brew ?
I had the same issue and wanted to install yarn via brew for various reasons. Honestly the only way is to use the actual link to the yarn.rb file in the Homebrew Repo for the version you want. The easiest way to find the .rb file through git is to check out the PRs in Git for yarn in the homebrew repo.
Before doing this though, run brew unlink yarn in order to allow an older version to be installed while keeping the newest version.
Then look up the PR of the version you want, here's a link to make your life easier.
Click the version you want and go to Files Changed tab. Click on View File button. Then click on Raw button and then copy the URL of this raw file
After you get that link, type in your terminal brew install [link] and you should be set
You can then use brew list --versions yarn to check your installed versions and brew switch to switch versions. You should have both the latest version you previously had installed and the version you just installed.
Some of the above answers don't seem to work anymore. Here is how I was able to install a specific version in April 2021:
brew unlink yarn#1.6.0 (If you already have a version installed)
brew extract --version 1.22.4 yarn homebrew/cask
brew install yarn#1.22.4
yarn -v
You can also use yvm, a yarn version manager instead of homebrew to install a specific or multiple versions of yarn
https://yvm.js.org/docs/overview
Enables easy switching between yarn versions, like nvm does for node
Hope this works for you guys.
To reinstall run below.
// Note:(updating homebrew) for Mac users.
brew install -g yarn
if yarn is still not found
brew reinstall yarn
As per official github page https://github.com/yarnpkg/yarn/issues/599 you should use "brew install -g yarn" to install yarn using brew.
PS: I've installed Xcode and gcc before running above command as i ran into few issues when executed above command.
You could also use yarn policies set-version <version>, but it has a caveat; it will "check in your Yarn release within your repository. Once you run it, your configuration will be updated in such a way that anyone running a Yarn command inside the project will always use the version you set - and this transparently."
You might not want to have the Yarn release in your repository.
Official doc
I've noticed this happening a few times but this most recent instance is with wp-cli Running brew upgrade wp-cli does not download the latest version.
$ brew upgrade wp-cli
Error: homebrew/php/wp-cli 0.20.1 already installed
$ brew info wp-cli
homebrew/php/wp-cli: stable 0.20.1, HEAD
A set of command-line tools for managing WordPress installations.
http://wp-cli.org/
/usr/local/Cellar/wp-cli/0.20.1 (2635 files, 15M) *
Built from source
From: https://github.com/Homebrew/homebrew-php/blob/master/Formula/wp-cli.rb
Note the version is 0.20.1. When I check the formula repo, I see,
head "https://github.com/wp-cli/wp-cli.git"
When I check that repo, I see that the version in the master branch is 0.24.0. brew info and wp --version both return 0.20.1. Why isnt Homebrew grabbing the latest version? How do I force it to get the latest?
You'll need to run brew update first to force brew to update its list of formulae.
I am trying to update brew on my Mac OS X machine so I can update php. However, when trying to run brew install, I get this error:
error: The following untracked working tree files would be overwritten by merge:
Library/Homebrew/extend/enumerable.rb
Please move or remove them before you can merge.
Aborting
Error: Failure while executing: git pull --quiet origin refs/heads/master:refs/remotes/origin/master
brew doctor:
Warning: Broken symlinks were found. Remove them with brew prune:
/usr/local/bin/wget
/usr/local/share/man/man1/wget.1
/usr/local/Library/LinkedKegs/wget
Check the solution here
https://github.com/Homebrew/homebrew/issues/21002
in Short
cd /usr/local
git status
git reset --hard origin/master
git clean -df
Type brew doctor and do what it tells you.
brew install is not what you are looking for. I believe if you do this
brew update
brew upgrade
You should be good. If you want more info you should check here https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/FAQ.md#faq
I'm installing brew for the first time, and down to one error when I run brew doctor:
Warning: You have uncommitted modifications to Homebrew
If this a surprise to you, then you should stash these modifications.
Stashing returns Homebrew to a pristine state but can be undone
should you later need to do so for some reason.
cd /usr/local && git stash
If I cd to /usr/local and run "git status" I get:
On branch master
nothing to commit (working directory clean)
If I run: cd /usr/local && git stash, I get:
No local changes to save
Should I ignore this warning? I'm on OSX 10.8.
I had this same issue, none of the above suggestions got rid of the warning for me.
It appears that Homebrew will complain about un-committed/un-stashed changes even if they haven't been added to a commit, and if they haven't been added to a commit, git stash won't do anything.
So what i had to do is:
$ cd /usr/local
$ git add . # add the unsaved changes homebrew is complaining about
$ git stash # stash the changes, now that they're in a commit
$ brew update # update homebrew
$ brew doctor # running brew doctor now outputs 'raring to brew'
Or if you want, run everything at once:
cd /usr/local/Homebrew && git add . && git stash && git clean -d -f && brew update && brew doctor
I found the problem, researching a different problem. My computer had an older version of git installed (1.5.6.56.g29b0d). It was located at /usr/local/bin/git. I downloaded the latest version (1.7.11.3) which installed itself at /usr/local/git/bin/git. After tweaking my PATH to recognize the new git, I was able to get past the error above.
brew doctor
Warning: Your Homebrew is outdated
You haven't updated for at least 24 hours, this is a long time in brewland!
Then I was able to run brew update successfully:
brew update
Updated Homebrew from ed127082 to 4a36c56a.
...
And now it looks like I'm good to go:
brew doctor
Your system is raring to brew.