ruby“权限被拒绝”安装/使用自制软件桶

时间:2017-01-25 15:16:41

标签: ruby macos homebrew homebrew-cask

我的赌注是,这个问题与我的基础osx ruby设置有某种关系......但由于我不是ruby-ite,我需要一些指导来发现更多。

几天前,我尝试安装brew cask公式(之前已经安装了其他几个公式)。几周前我升级到OSX Sierra。

Brew本身效果很好,brew cask没有。

当我自己或使用任何子命令键入brew cask时出现“意外”错误:

Error: ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for ruby/st.h... yes
checking for st.h... yes
checking for rb_str_replace() in ruby.h... yes
creating Makefile
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:2125:in `initialize': Permission denied - Makefile (Errno::EACCES)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:2125:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:2125:in `create_makefile'
    from extconf.rb:24:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/msgpack-0.5.8 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-16/2.0.0/msgpack-0.5.8/gem_make.out

我查看了许多问题并尝试了许多答案,但都无济于事。

  

问题:
  Homebrew cask option not recognized?
  Failed to build gem native extension (installing Compass)
  homebrew not working on OSX Can't install Brew formulae correctly (Permission denied in /usr/local/lib)
  OsX, can't use Homebrew because of Ruby permission

尝试:

> xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

> brew install ruby
Warning: ruby-2.4.0 already installed

> ls -l /System/Library/Frameworks/Ruby.framework/Versions/
drwxr-xr-x 7 root wheel 238 2017-01-12 12:12:13 2.0
lrwxr-xr-x 1 root wheel   3 2017-01-09 09:47:51 Current -> 2.0

> sudo chown -R $(whoami):admin /usr/local
> sudo chmod -R g+w /usr/local

> brew install caskroom/cask/brew-cask
> brew cask [list|cleanup|update|etc]
(gives error shown above)

执行完整的自制软件卸载,rm添加额外的目录和文件。然后完成自制程序重新安装,然后重新安装我以前的许多公式。

上面的相同命令在重新安装后会出现相同的错误。

让我感到困惑。 ?

1 个答案:

答案 0 :(得分:0)

所以我刚刚解决了类似问题 - 对我来说这是一个权限问题。我最终跑了:

sudo chown -R $(whoami) your-directory-here
在Cask和caskroom目录上的

- 您可能需要查看一下才能在系统上找到这些目录。