I am not able to install and run fakes3
gem on El Capitan Beta 5.
I tried:
sudo gem install fakes3
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/fakes3
Then I tried doing it the cocoapods way. It worked for cocoapods but not for fakes3.
mkdir -p $HOME/Software/ruby
export GEM_HOME=$HOME/Software/ruby
gem install cocoapods
[...]
1 gem installed
gem install fakes3
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
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:
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.
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
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.)