Can't install gems on OS X El Capitan
Disclaimer: @theTinMan and other Ruby developers often point out not to use sudo
when installing gems and point to things like RVM. That's absolutely true when doing Ruby development. Go ahead and use that.
However, many of us just want some binary that happens to be distributed as a gem (e.g. fakes3
, cocoapods
, xcpretty
…). I definitely don't want to bother with managing a separate ruby. Here are your quicker options:
Option 1: Keep using sudo
Using sudo
is probably fine if you want these tools to be installed globally.
The problem is that these binaries are installed into /usr/bin
, which is off-limits since El Capitan. However, you can install them into /usr/local/bin
instead. That's where Homebrew install its stuff, so it probably exists already.
sudo gem install fakes3 -n/usr/local/bin
Gems will be installed into /usr/local/bin
and every user on your system can use them if it's in their PATH.
Option 2: Install in your home directory (without sudo)
The following will install gems in ~/.gem
and put binaries in ~/bin
(which you should then add to your PATH
).
gem install fakes3 --user-install -n~/bin
Make it the default
Either way, you can add these parameters to your ~/.gemrc
so you don't have to remember them:
gem: -n/usr/local/bin
i.e. echo "gem: -n/usr/local/bin" >> ~/.gemrc
or
gem: --user-install -n~/bin
i.e. echo "gem: --user-install -n~/bin" >> ~/.gemrc
(Tip: You can also throw in --no-document
to skip generating Ruby developer documentation.)
Having issues installing ruby gems after latest OS X El Capitan update
Don't forget that installing things into the system Ruby requires sudo
privileges, /Library
is usually restricted access.
Installing your own personal Ruby with rvm
or rbenv
avoids all this.
Can't install thrift gem on OS X El Capitan
I have a solution for you! Hopefully.
Had this same problem the other day.
The problem is in the clang compiler that El Capitan comes bundled with. I'm sure it screws up other issues but this is one point that I had a lot of issues with.
Try running the following command and let me know how it goes!
gem install thrift -- --with-cppflags=\"-D_FORTIFY_SOURCE=0 -Wno-shift-negative-value\"
gem install rmagick fails on OS X El Capitan
Fixed it.
The magic command to run is this:
xcode-select --install
Getting an error trying to install a particular gem 'oily_png (1.2.0)' MAC OS X El Capitan
On a Mac anytime you upgrade Xcode or the operating system, there appears to be a chance of the command line tools being removed.
xcode-select --install
in the terminal window, will install the tools, this can also be done inside the xcode application.
[~] xcode-select -h
Usage: xcode-select [options]
Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example,
xcodebuild) as well as the BSD development commands (such as cc and make).
Options:
-h, --help print this help message and exit
-p, --print-path print the path of the active developer directory
-s <path>, --switch <path> set the path for the active developer directory
--install open a dialog for installation of the command line developer tools
-v, --version print the xcode-select version
-r, --reset reset to the default command line tools path
if you have more than one set of tools installed (such as beta version) the -s, --switch
flag is also helpful to get it pointed to one you want to use (or if the version it was pointed to was removed)
Install therubyracer gem on OSX 10.11 El Capitan
- Install xcode through app store
- Install 'command line tools' for xcode (
xcode-select --install
) - If using rbenv, after installing ruby you needed
rbenv rehash
Assuming you have run
gem install bundler
and got errors, remove your mess:gem uninstall libv8
gem uninstall therubyracer
brew rm v8Install gcc4.2
brew tap homebrew/dupes
brew install apple-gcc42Install v8
brew tap homebrew/versions
brew install v8-315
brew link --force v8-315Install gems
gem install libv8 -- --with-system-v8
gem install therubyracerif you get
dyld: lazy symbol binding failed: Symbol not found
, @rpbaltazar suggests an alternative:bundle config --local build.libv8 --with-cxx=/usr/local/bin/g++-4.2
bundle install
gem update/install operation not permitted since el capitan. how to set default path
Having the same problems, found this:
- Boot into the Recovery HD by restarting whilst holding ⌘R.
- Open Terminal (from the Utilities menu).
- Run the following command in Terminal:
csrutil disable
- Restart
source: https://georgegarside.com/blog/osx/package-incompatible-installer/
Related Topics
How to Search Within an Array of Hashes by Hash Values in Ruby
Get Names of All Files from a Folder With Ruby
Rails Update_Attributes Without Save
Need a Simple Explanation of the Inject Method
Git, Heroku: Pre-Receive Hook Declined
How to Match the Last Occurrence of a Pattern
How to Get the Current Absolute Url in Ruby on Rails
How to Skip the First Line of a CSV File and Make the Second Line the Header
How to Install a Gem or Update Rubygems If It Fails With a Permissions Error
Why Does Ruby Have Both Private and Protected Methods
Error to Install Nokogiri on Osx 10.9 Maverick
How to Create an Average from a Ruby Array
Using Rails Serialize to Save Hash to Database