Search code examples
rubyutf-8splithomebrewwine

Homebrew and ruby error with UTF-8 and 'split'


I used Homebrew to install an older version of Wine because the program I needed was only able to run on the older version of Wine. However, I decided to update Wine because I had learnt that the program became able to run on the newest version of Wine too. Since I got some errors and was not able to update, I decided to delete Homebrew and isntall everything again. Some errors said something about Ruby and therefore I decided to update Ruby to version 2.1.2 according to this tutorial: http://railsapps.github.io/installrubyonrails-mac.html Then I installed Homebrew, which successfully installed but when I issued brew doctor command and I get this:

/usr/local/Library/Homebrew/global.rb:109:in `split': invalid byte sequence in UTF-8 (ArgumentError)
from /usr/local/Library/Homebrew/global.rb:109: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>'

I found several similar questions about UTF-8 encoding problem but none solved my problem. However, I found something about forbidden characters in the PATH, which can be found out by issuing echo $PATH, which displays this:

/usr/local/bin:/Users/Martin/.rvm/gems/ruby-2.1.2/bin:/Users/Martin/.rvm/gems/ruby-2.1.2@global/bin:/Users/Martin/.rvm/rubies/ruby-2.1.2/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin??n’export??n’export:/Users/Martin/.rvm/bin

I know that I probably have to change something somewhere but please bear in mind that I am an inexperienced user with only basic knowledge of command line. I have no idea what Ruby is and what it is for. I would really appreciate if you could help me please. Thank you very much in advance.


Solution

  • You're on the right track:

    /opt/X11/bin??n’export??n’export
    

    This definitely appears to be the culprit. To verify that it is, try reassigning your PATH variable like so:

    export PATH=/usr/local/bin:/Users/Martin/.rvm/gems/ruby-2.1.2/bin:/Users/Martin/.rvm/gems/ruby-2.1.2@global/bin:/Users/Martin/.rvm/rubies/ruby-2.1.2/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/Martin/.rvm/bin
    

    Notice that I took out the potential offending culprit. After running this command, try running brew doctor again.

    If this is indeed the problem, visit this SuperUser Question: https://superuser.com/a/69190/96285

    It should tell you the various files your PATH is set - you should be able to find and remove the offending entry from one of these files.