Got warning message when running brew list

1

When I run brew list on my Mac OS X EI Capitan, it will always give me errors message like this --

$ brew list
/bin/sh: __rvm_ruby_string_find: line 8: syntax error near unexpected token `('
/bin/sh: __rvm_ruby_string_find: line 8: ` ruby-+([1-9]) | ruby-+([1-9]).+([0-9]) | ruby-1.+([1-9]).+([0-9]) | jruby-[19]*)'
/bin/sh: error importing function definition for `__rvm_ruby_string_find'
/bin/sh: __rvm_project_ruby_env_load_parse_file: line 9: syntax error near unexpected token `('
/bin/sh: __rvm_project_ruby_env_load_parse_file: line 9: ` __rvm_read_lines __variables <( { cat "$1"; echo ""; } | __rvm_sed "${__sed_commands[@]}" )'
/bin/sh: error importing function definition for `__rvm_project_ruby_env_load_parse_file'
/bin/sh: __rvm_remove_without_gems: line 2: syntax error near unexpected token `('
/bin/sh: __rvm_remove_without_gems: line 2: ` __rvm_read_lines __gems_to_remove <('
/bin/sh: error importing function definition for `__rvm_remove_without_gems'
gdbm        openssl     python      readline    sqlite

Image Link

Every time running rvm, it will also give me similar error message.

$ rvm
bash: __rvm_ruby_string_find: line 8: syntax error near unexpected token `('
bash: __rvm_ruby_string_find: line 8: ` ruby-+([1-9]) | ruby-+([1-9]).+([0-9]) | ruby-1.+([1-9]).+([0-9]) | jruby-[19]*)'
bash: error importing function definition for `__rvm_ruby_string_find'

How can I resolve it? Thanks!

Haoyu Chen

Posted 2015-11-05T02:05:35.097

Reputation: 111

Answers

1

OS X ships with an older version of ruby. Use homebrew to install a newer version of ruby and see if that fixes the issue

$ brew install ruby

You'll also want to make sure that /usr/local/bin/ruby is in your $PATH before any other ruby version. Honestly, I can't remember if the install does this automatically but it's good to check.

SaxDaddy

Posted 2015-11-05T02:05:35.097

Reputation: 3 181

I just ran the command above, but it still gave me same error. So when you say checking the path, how can I make sure /usr/local/bin/ruby is in my path. Where can I check it? .profile? – Haoyu Chen – 2015-11-05T06:33:14.340

I print out the $PATH, I can;t find /usr/local/bin/ruby, so does it mean that I need to add it by myself? – Haoyu Chen – 2015-11-05T06:35:29.533

Check the path with echo $PATH. Then run brew install ruby. Read the console output. Most packages will make you aware of any special changes you need to make. If the ruby package does not mention it, then you can add something like PATH='/usr/local/bin/ruby:${PATH}' to your bash profile – SaxDaddy – 2015-11-05T06:42:43.653

it doesn't solve the problem and it still give me same error. After I add the path to $PATH and reinstall ruby by command -- brew install ruby. – Haoyu Chen – 2015-11-05T14:32:04.783

have you tried uninstalling and then reinstalling homebrew? – SaxDaddy – 2015-11-06T07:58:58.083

I tried it, but it looks like it has nothing to do with homebrew. When I install homebrew, it will also give me the error message. http://postimg.org/image/gadkva8rv/

– Haoyu Chen – 2015-11-07T23:06:27.170

It's ruby's issue...Very possible. Still can't figure it out :( – Haoyu Chen – 2015-11-07T23:06:58.110