当我brew list
在 Mac OS X EI Capitan 上运行时,它总是会给我这样的错误消息——
$ 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
图像关联
每次运行 rvm 时,它也会给我类似的错误信息。
$ 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'
我该如何解决?谢谢!
答案1
OS X 附带旧版本的 ruby。使用 homebrew 安装较新版本的 ruby,看看是否能解决问题
$ brew install ruby
您还需要确保/usr/local/bin/ruby
在安装任何其他 ruby 版本之前先安装它$PATH
。老实说,我不记得安装是否会自动执行此操作,但最好检查一下。