0

I tried to install asitop through brew but it doesn't exist (yet) as a package (see comments).

The tentative installation triggered an update of the existing brew packages. From then on, each time I invoke a brew command I get the following (even when issuing a brew doctor command):

/usr/local/Homebrew/Library/Homebrew/PATH.rb:93:in `split': invalid byte sequence in UTF-8 (ArgumentError)
    from /usr/local/Homebrew/Library/Homebrew/PATH.rb:93:in `block in parse'
    from /usr/local/Homebrew/Library/Homebrew/PATH.rb:93:in `each'
    from /usr/local/Homebrew/Library/Homebrew/PATH.rb:93:in `flat_map'
    from /usr/local/Homebrew/Library/Homebrew/PATH.rb:93:in `parse'
    from /usr/local/Homebrew/Library/Homebrew/PATH.rb:25:in `initialize'
    from /usr/local/Homebrew/Library/Homebrew/global.rb:124:in `new'
    from /usr/local/Homebrew/Library/Homebrew/global.rb:124:in `<top (required)>'
    from /usr/local/Homebrew/Library/Homebrew/brew.rb:21:in `require_relative'
    from /usr/local/Homebrew/Library/Homebrew/brew.rb:21:in `<main>'

echo $PATH renders the following:

?/usr/libexec:/Users/profilename/.gem/ruby/2.6.0/bin:/Users/profilename/Library/Python/3.8/bin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:~/.gem/ruby/2.6.0/bin:/usr/local/opt/ruby/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin

I stumbled on this stackoverflow thread, but unfortunately I failed to generalise the solution to my case.

Kindly note that I have istats installed (see this thread for installation procedure).

Can someone please help me to solve this problem?

pdeli
  • 633
  • There's no such package asitop in the main Homebrew repo. Have you installed it from a 3rd party repo? You'll also have to elaborate on why the installation of istats is relevant. – Andy Griffiths Aug 25 '22 at 14:46
  • @AndyGriffiths: Thanks for your comment. Just checked and you're correct. I guess that what I thought being the installation of asitop, was the Running `brew update --auto-update`.... Also I specified that istats is installed because it's intallation affected the result of the echo $PATH command (I thought it might be relevant at some point). – pdeli Aug 25 '22 at 14:58
  • Please edit your question to focus on the actual problem, details in comments easily get lost. – nohillside Aug 25 '22 at 21:55
  • Also, what is the ? doing at the beginning of PATH? – nohillside Aug 25 '22 at 21:56
  • @nohillside. Thanks for your comments. I have no idea why there is a ? at the beginning of the result of echo $PATH. I only pasted the result of the command. Should I remove it? If yes, how? – pdeli Aug 26 '22 at 11:05
  • type export PATH=, copy/paste the good part of the path (make sure there is no space after the =, then press enter. Then rerun the brew command again. This will not solve the ? issue in general (we come to that later) but helps to figure out what is breaking brew. – nohillside Aug 26 '22 at 11:54
  • @nohillside. Thanks for your answer. That seem to have done it! As suggested I exported the PATH with the content in the question, but without the leading ?and brew doctor does not throw the mentioned error back (I just have some warnings that homebrew says I can ignore if everything works for me. Thanks again! – pdeli Aug 26 '22 at 12:22
  • I used Homebrew for about 3 weeks several years ago - a dismal, frustrating experience. Then I learned about MacPorts - been using it ever since. – Seamus Aug 27 '22 at 17:42

1 Answers1

2

There is a ? at the beginning of your PATH which for sure should not be there. If it persists (open a new Terminal tab to verify), you need to look through the startup files of your shell and into /etc/paths//etc/paths.d/* to check where it gets added.

nohillside
  • 100,768