El Capitan更新rails

时间:2015-10-01 01:07:31

标签: ruby-on-rails osx-elcapitan

刚刚将我的系统更新为El Capitan,当启动rails服务器(在Yosemite上完美运行)时,我收到以下警告。

Ignoring bcrypt-3.1.10 because its extensions are not built.  Try: gem pristine bcrypt --version 3.1.10
Ignoring bcrypt-ruby-3.1.2 because its extensions are not built.  Try: gem pristine bcrypt-ruby --version 3.1.2
Ignoring bcrypt-ruby-3.0.1 because its extensions are not built.  Try: gem pristine bcrypt-ruby --version 3.0.1
Ignoring binding_of_caller-0.7.2 because its extensions are not built.  Try: gem pristine binding_of_caller --version 0.7.2
Warning: Running `gem pristine --all` to regenerate your installed gemspecs (and deleting then reinstalling your bundle if you use bundle --path) will improve the startup performance of Spring.

运行引用的命令时,我得到:

-bash: bundle: command not found
rails update
Ignoring json-1.8.1 because its extensions are not built.  Try: gem pristine json --version 1.8.1
Ignoring json-1.8.2 because its extensions are not built.  Try: gem pristine json --version 1.8.2
Ignoring json-1.8.3 because its extensions are not built.  Try: gem pristine json --version 1.8.3
Ignoring nokogiri-1.6.6.2 because its extensions are not built.  Try: gem pristine nokogiri --version 1.6.6.2
Ignoring atomic-1.1.14 because its extensions are not built.  Try: gem pristine atomic --version 1.1.14
Ignoring atomic-1.1.14 because its extensions are not built.  Try: gem pristine atomic --version 1.1.14
Ignoring bcrypt-ruby-3.0.1 because its extensions are not built.  Try: gem pristine bcrypt-ruby --version 3.0.1
Ignoring binding_of_caller-0.7.2 because its extensions are not built.  Try: gem pristine binding_of_caller --version 0.7.2
Warning: Running `gem pristine --all` to regenerate your installed gemspecs (and deleting then reinstalling your bundle if you use bundle --path) will improve the startup performance of Spring.
Could not find bcrypt-3.1.10 in any of the sources
Run `bundle install` to install missing gems.

也试过跑:

sudo gem pristine --all
Restoring gems to pristine condition...
ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted - /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0/gems/CFPropertyList-2.2.8/README

现在,它甚至无法找到捆绑安装路径。好像更新确实搞砸了。

当我运行gem pristine --all时,我得到以下内容:

Restored bcrypt-ruby-3.1.5
Skipped bigdecimal-1.2.0, it is a default gem
Building native extensions.  This could take a while...
Restored binding_of_caller-0.7.2
Restored bootstrap-sass-3.3.5.1
Restored builder-3.2.2
Restored builder-3.1.4
Restored bundler-1.10.6
Restored bundler-1.9.6
Building native extensions.  This could take a while...
ERROR:  While executing gem ... (Gem::Ext::BuildError)
    ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r     ./siteconf20151001-3494-1jca623.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
make: *** No rule to make target `/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin15/ruby/config.h', needed by `breakpoint.o'.  Stop.

make failed, exit code 2

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

2 个答案:

答案 0 :(得分:5)

解决方案位于以下link

硬件

升级到El Capitan,Homebrew&红宝石

...和Xcode和Java等

如果您还没有安装自制软件,请先执行此操作,这样您就不必处理SIP问题。安装Apple菜单中提供的所有软件更新,包括El Capitan。

在安装并强制重新启动后,我的27“Thunderbolt显示屏将不会显示任何内容。拔下插头,重新插入没有帮助。再重启一次就修好了。

软件

按顺序......

的Xcode

El Capitan安装消除了我的Xcode安装,所以我不得不在App Store中搜索它并重新安装。我现在相信我之前删除了Xcode并忘了,因此重新安装。我是在一台我很少使用的机器上做到的。

Xcode安装完成后,打开我用作Terminal.app替代品的iTerm,或者如果您愿意,可以打开Terminal.app。

∴ xcode-select --install
xcode-select: note: install requested for command line developer tools

打开一个对话框,我选择了“安装”,大约一分钟就完成了。

的Java

接下来,运行java,它会显示一个对话框,其中包含一个“更多信息”按钮,该按钮会将您带到一个可以接受许可并下载Java .dmg文件的网站。如果您打算运行基于java命令行的工具,则需要JDK而不是JRE。

Unable to find any JVMs matching version "1.7".
No Java runtime present, try --request to install.

∴ java

No Java runtime present, requesting install.

下载后,打开.dmg(对我来说是jdk-8u60-macosx-x64.dmg)并安装,然后重启iTerm。

∴ java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

像RubyMine这样的应用程序现在可以正常工作,至少可以启动。

自制

医生告诉我几个警告,我按照指示照顾。

∴ brew doctor
∴ sudo chown -R $(whoami):admin /usr/local
∴ cd /usr/local/Library && git stash && git clean -d -f
∴ cd ~
∴ brew prune
∴ brew unlink qt5

然后我能够更新Homebrew。

∴ brew update

QT5

我知道capybara-webkit gem需要qt5,而且我知道qt是homebrew / El Capitan问题跟踪器中的主要遗留问题之一,所以我决定先把它弄出来。

∴ brew uninstall qt5
∴ brew install qt5
∴ brew linkapps qt5
∴ brew link --force qt5

需要最后一行才能使qmake可用。检查qmake。否则,您将在稍后的Capybara安装上结束此操作:

  

Gem :: Ext :: BuildError:错误:无法构建gem原生扩展。

/Users/pboling/.rvm/rubies/ruby-2.1.2/bin/ruby -r ./siteconf20150930-48087-1vw6bye.rb extconf.rb
sh: qmake: command not found
*** extconf.rb failed ***

GPG

现在正在使用GPG签署一些软件,例如RVM,所以安装它。

∴ brew install gpg

RVM

我的Ruby正在运行,但是我遇到了一些本机gem安装问题,因此我决定开始使用针对所有新的自制程序和Xcode库编译的Ruby。

∴ rvm implode

由于权限问题,Implode实际上无法删除主~/.rvm目录。我不得不把它删掉。

∴ sudo rm -rf /Users/pboling/.rvm

按照此处的说明安装RVM,我安装了开发版本,希望它有更多的El Capitan修复程序:

∴ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
∴ \curl -sSL https://get.rvm.io | bash

我目前使用的主要应用程序是使用Ruby 2.1.2,所以我首先安装它,然后转到项目目录以创建gemset并捆绑。

∴ rvm install 2.1.2
∴ cd ~/project
∴ gem install bundler -v 1.9.7
∴ bundle install

Bundler版本1.9.7,因为这就是Heroku的用途,我希望保持同步,因为1.10 *改变了使Gemfile.lock在部署的服务器上与1.9.7不兼容的东西(对我而言,多个宝石源,私人宝石服务器等)。

的Postgres

我也借此机会升级到最新的Postgres.app。或者,您可以使用brew install postgres安装postgres。我选择了Postgres.app,因为Heroku直接支持它,我喜欢认为那里有一个奇偶校验胜利。

答案 1 :(得分:2)

你应该尝试RVM或RBENV或者本周的味道。这将允许您基于每个项目轻松管理Ruby解释器和Gemsets。我仍然使用RVM,我对它非常满意。

https://rvm.io/rvm/install