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!

1 Answer 1

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.

7
  • 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
    Nov 5, 2015 at 6:33
  • 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
    Nov 5, 2015 at 6:35
  • 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
    Nov 5, 2015 at 6:42
  • 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
    Nov 5, 2015 at 14:32
  • have you tried uninstalling and then reinstalling homebrew?
    – SaxDaddy
    Nov 6, 2015 at 7:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .