ruby-on-rails - El Capitan 更新 rails

标签 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

最佳答案

解决方法如下link .

硬件

使用 Homebrew 和 Ruby 升级到 El Capitan

...以及Xcode和Java等。

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

安装并强制重启后,我的 27 英寸 Thunderbolt 显示器将不显示任何内容。拔下插头,重新插入没有帮助。再重启一次即可修复它。

软件

为了...

Xcode

El Capitan 安装清除了我的 Xcode 安装,所以我不得不在 App Store 中搜索并重新安装。我现在相信我不久前删除了 Xcode 并忘记了,因此重新安装。我在我很少使用的机器上做了这个。

Xcode 安装完成后,打开 iTerm,我将其用作 Terminal.app 的替代品,如果您愿意,也可以打开 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: ERROR: Failed to build gem native extension.


/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

虚拟机

我的 Ruby 工作正常,但我在安装一些原生 gem 时遇到了问题,所以我决定重新开始使用针对所有新的自制程序和 Xcode 库编译的 Ruby。
∴ rvm implode

Implode 实际上未能删除主要 ~/.rvm目录由于权限问题。我不得不 sudo 删除它。
∴ 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 不兼容(对我来说,有多个 gem 源、私有(private) gem 服务器等)。

Postgres

我还借此机会升级到了最新的 Postgres.app。或者,您可以使用 brew install postgres 安装 postgres。我选择 Postgres.app 是因为 Heroku 直接支持它,而且我喜欢认为在某个地方存在平价胜利。

关于ruby-on-rails - El Capitan 更新 rails ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32877953/

相关文章:

python - 在 Mac El Capitan 上安装 python-igraph 时出现问题

ruby-on-rails - OS X El Capitan - 无法使用 gem 安装 bundler

El Capitan 上的 PHP.ini 位置

ruby-on-rails - ajax 请求后无法显示 Twitter Bootstrap 模式

ruby-on-rails - Capistrano puma :restart not working, 但 puma:start 是

sql - Rails - 在日志文件中查看生成的 SQL 查询

ruby-on-rails - 使用 Koala 将图片发布到 Facebook 群组

macos - NSHTTPCookieStorage sharedHTTPCookieStorage 在 10.11 中显示为空?

ios - 我基于 CoreLocation 的 Swift 应用程序未请求用户访问位置的权限

ruby-on-rails - Rspec Controller 测试没有命中我的 Controller 操作