【问题标题】:Error Installing Jekyll on Mac OS Mavericks (10.9.2)在 Mac OS Mavericks (10.9.2) 上安装 Jekyll 时出错
【发布时间】:2014-04-12 16:52:10
【问题描述】:

尝试在 OSX Mavericks 上安装 Jekyll 的稳定版本。我已经安装了 Xcode 和命令行工具,但我得到了这个错误:


sudo gem install jekyll
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing jekyll:
    ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling porter.c
porter.c:359:27: warning: '&&' within '||' [-Wlogical-op-parentheses]
      if (a > 1 || a == 1 && !cvc(z, z->k - 1)) z->k--;
                ~~ ~~~~~~~^~~~~~~~~~~~~~~~~~~~
porter.c:359:27: note: place parentheses around the '&&' expression to silence this warning
      if (a > 1 || a == 1 && !cvc(z, z->k - 1)) z->k--;
                          ^
                   (                          )
1 warning generated.
compiling porter_wrap.c
linking shared-object stemmer.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [stemmer.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/fast-stemmer-1.0.2 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/fast-stemmer-1.0.2/gem_make.out

【问题讨论】:

标签: ruby macos rubygems osx-mavericks jekyll


【解决方案1】:

Xcode 5.1 出现了您的问题。为了避免与 MacOS 的 ruby​​ 版本(这个和许多其他版本)相关的许多问题,你真的应该使用RVM

如果您还没有,请先安装 Homebrew:(这不是绝对必要的,但允许我们安装 ruby​​ 及其依赖项而无需长时间编译)

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

然后,以下命令将安装 RVM 和 Ruby 的最新版本:

\curl -L https://get.rvm.io | bash -s stable --ruby

检查一切正常:

ruby --version

您现在可以安装 Jekyll:

gem install jekyll

现在,如果你真的不想使用 RVM,你可以执行:

sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install jekyll

但我敢打赌还会出现更多问题。

【讨论】:

  • 很好的答案!但这应该说 Xcode 5.1 而不是 Xcode 1.5?
【解决方案2】:

您绝对应该使用 RVM。步骤如下:

  1. 通过从 Applications 文件夹中删除 XCode 来卸载任何现有 XCode。
  2. 安装 Homebrew。

    ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
    
  3. 按照 Homebrew 安装中列出的其他说明进行操作。

    brew doctor
    
  4. 安装 RVM。

    \curl -L https://get.rvm.io | bash -s stable --ruby
    
  5. 在安装 RVM 时遵循其他说明。

    source ~/.rvm/scripts/rvm
    
  6. 安装 jekyll。

    gem install jekyll
    
  7. 测试 jekyll。

    $ jekyll serve
    
    Configuration file: none
    
            Source: /private/var/log
    
       Destination: /private/var/log/_site
    
      Generating... done.
    
    Server address: ...
    
    Server running... press ctrl-c to stop.
    

【讨论】:

    【解决方案3】:

    1) xcode-select --install

    2) 酿造安装红宝石

    3) sudo gem install jekyll

    4) sudo gem install jekyll-import

    【讨论】: