我无法通过控制台中的irb访问ruby。问题是什么?
$ irb
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir': Permission denied - /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/json-1.8.1 (Errno::EACCES)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:in `fu_mkdir'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:219:in `block (2 levels) in mkdir_p'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:217:in `reverse_each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:217:in `block in mkdir_p'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:203:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:203:in `mkdir_p'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:210:in `write_gem_make_out'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:132:in `build_error'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:171:in `rescue in build_extension'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:156:in `build_extension'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:198:in `block in build_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:195:in `each'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:195:in `build_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1436:in `block in build_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/user_interaction.rb:45:in `use_ui'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1434:in `build_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/stub_specification.rb:60:in `build_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:925:in `block in find_inactive_by_path'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924:in `each'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924:in `find'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924:in `find_inactive_by_path'
from /Library/Ruby/Site/2.0.0/rubygems.rb:185:in `try_activate'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/locale.rb:150:in `block in search_file'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/locale.rb:158:in `block in each_localized_path'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/locale.rb:167:in `each_sublocale'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/locale.rb:157:in `each_localized_path'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/locale.rb:145:in `search_file'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/locale.rb:124:in `find'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/locale.rb:108:in `load'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/locale.rb:32:in `initialize'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/init.rb:114:in `new'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/init.rb:114:in `init_config'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb/init.rb:16:in `setup'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/irb.rb:380:in `start'
from /usr/bin/irb:12:in `<main>'
答案 0 :(得分:0)
我遇到了同样的问题,不知何故,JSON gem无法使用或删除。我再次安装了json gem,现在是ruby&amp; irb现在就会运行。
sudo gem install json