Search code examples
ruby-on-railsosx-elcapitan

El Capitan Update rails


Just updated my system to El Capitan and when launching the rails server (that worked perfectly on Yosemite) I get the following warning.

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.

when running the referenced commands I get:

-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.

also tried running:

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

So now, it can't even find the bundle install path. Seems like the update has really messed it up.


When I run gem pristine --all I get the following:

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

Solution

  • Solution is in the following link.

    Hardware

    Upgrade to El Capitan, with Homebrew & Ruby

    ... and Xcode and Java, etc.

    If you don't already have homebrew installed, do that first, so you don't have to deal with SIP issues. Install all Software Updates available in the Apple Menu, up to and including El Capitan.

    After the installs and forced reboots my 27" Thunderbolt display wouldn't display anything. Unplug, replug didn't help. One more reboot fixed it.

    Software

    In order...

    Xcode

    The El Capitan install wiped out my Xcode install, so I had to search for it in the App Store and reinstall. I now believe that I deleted Xcode awhile ago and forgot, hence the reinstall. I did this on a machine that I rarely use.

    After Xcode is finished installing, open iTerm, which I use as a Terminal.app replacement, or Terminal.app if you are so inclined.

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

    A dialog opened, I chose "Install", which finished in about a minute.

    Java

    Next, run java, which prompts with a dialog that has a button "More Info" which takes you to a website where you can accept the license and download the Java .dmg file. You need the JDK, not the JRE, if you intend to run java command-line based tools.

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

    Once downloaded, open the .dmg (for me it was jdk-8u60-macosx-x64.dmg) and install, then restart 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)
    

    Apps like RubyMine should work now, well, at least launch.

    Homebrew

    The doctor informed me of several warnings which I took care of as instructed.

    ∴ 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
    

    Then I was able to update Homebrew.

    ∴ brew update
    

    qt5

    I know the capybara-webkit gem will require qt5, and I know qt is one of the primary remaining pain points in homebrew / El Capitan issues tracker, so I decided to get it out of the way first.

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

    That last line is required to make qmake available. Check with which qmake. Otherwise you will end up with this on the Capybara install later on:

    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

    Some software is now being signed with GPG, like RVM, for example, so install it.

    ∴ brew install gpg
    

    RVM

    My Ruby was working, but I was having trouble with some native gem installations, so I decided to start fresh with a Ruby compiled against all the new homebrew and Xcode libraries.

    ∴ rvm implode
    

    Implode actually failed to remove the main ~/.rvm directory due to permissions issues. I had to sudo remove it.

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

    Follow the instructions here for installing RVM, I installed the development version, hoping it would have more El Capitan fixes in it:

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

    The main app I currently work on is using Ruby 2.1.2, so I install that first, and then go to the project directory to have the gemset created and to bundle.

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

    Bundler version 1.9.7 because that's what Heroku is on, and I want to stay in sync, because 1.10* changed things that make the Gemfile.lock incompatible with 1.9.7 on the deployed server (for me, with multiple gem sources, private gem server, etc).

    Postgres

    I also took the opportunity to upgrade to the latest Postgres.app. Alternatively you can install postgres with brew install postgres. I choose Postgres.app begause it is supported directly by Heroku, and I like to think there is a parity win there somewhere.