QUESTION :
Ok so I was having problems with homebrew where it would give me an error when I use any brew command, so I decided to reinstall homebrew. I used the most standard uninstallation commands you see on the internet.
After checking the brew command isn’t recognized by the console, I installed homebrew again.
This is what happened.
localhost:~ ~~~~~~~~$ ruby -e "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew
Password:
==> Downloading and installing Homebrew...
remote: Counting objects: 199994, done.
remote: Compressing objects: 100% (54010/54010), done.
remote: Total 199994 (delta 144802), reused 199994 (delta 144802)
Receiving objects: 100% (199994/199994), 41.97 MiB | 187.00 KiB/s, done.
Resolving deltas: 100% (144802/144802), done.
From https://github.com/Homebrew/homebrew
* [new branch] master -> origin/master
HEAD is now at 5057268 ledger: update 3.0.3_1 bottle.
-e:196:in `split': invalid byte sequence in UTF-8 (ArgumentError)
from -e:196:in `<main>'
When I execute “brew”, this is what is says.
localhost:~ ~~~~~~~~$ brew
/usr/local/Library/Homebrew/global.rb:105:in `split': invalid byte sequence in UTF-8 (ArgumentError)
from /usr/local/Library/Homebrew/global.rb:105:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/brew.rb:16:in `<main>'
It would be very nice if any of you could help me. Thanks.
ANSWER :
I had a similar problem and it was because I had rbenv installed but hadn’t added the paths to my $PATH
environment variable.
If you use bash then try the following:
- Add
eval "$(rbenv init -)"
to your~/.bash_profile
. - Check that
~/.rbenv/bin
and~/.rbenv/shims
are in your$PATH
by runningecho $PATH
If you use Fish Shell then you need to load rbenv in a different way. Add the following 3 lines to your ~/.config/fish/fish.config
file:
set PATH $HOME/.rbenv/bin $PATH
set PATH $HOME/.rbenv/shims $PATH
rbenv rehash >/dev/null ^&1