4

I'm trying to install Bundler on my Mac which is running OS X El Capitan Public Beta 6 (15A278b).

I try sudo gem install bundler but I get the following error back

ERROR: While executing gem ... (Errno:EPERM)
Operation not permitted - /usr/bin/bundle

3
  • It seems as if you need to disable rootless. Since you are using beta software the procedure may change but you can try sudo nvram boot-args="rootless=0";sudo reboot.
    – fd0
    Commented Sep 4, 2015 at 11:22
  • Still doesn't work Commented Sep 4, 2015 at 11:34
  • 1
    You'll need to disable rootless my going into Recovery HD and turning it off. Commented Sep 4, 2015 at 11:38

5 Answers 5

0
  1. Boot into the Recovery HD by restarting whilst holding ⌘R.
  2. Open Terminal (from the Utilities menu).
  3. Run the following command in Terminal:

    csrutil disable
    
  4. Restart.

Source: Package is incompatible with this version of OS X

1
  • Fighting Apple's security practices by disabling it wholesale is both a losing battle and counter-productive. Bundler recommends -n /usr/local/bin gem installs now, as do most other active ruby projects. Commented Jun 30, 2017 at 13:48
3

For future reference, use a newer version of bundler - disabling a core security feature of the operating system is a Bad Idea and will leave your machine vulnerable.

1
  • You can re-enable SIP once installation is complete. SIP was non-existent on prior versions of OS X so you're not creating a huge security hole.
    – grg
    Commented Sep 19, 2016 at 10:02
2

sudo gem install -n /usr/local/bin bundler

2

Use rbenv (or rvm if you prefer, I don't). If you ever have to use sudo while installing/upgrading a gem then you're walking towards trouble, if not already there.

0

I prefer to not ever disable SIP so here's another way to get the bundler gem installed without needing to mess with restricted file permissions and reboot twice.

sudo mkdir -p /usr/local/bin/rubygems
sudo chown user:group /usr/local/bin/rubygems
export GEM_HOME=/usr/local/rubygems/
gem install bundler

Now, you'll probably want to export the GEM_HOME variable in a shell dot file or make a configuration file for gem. You'll certainly need to change the user and group for the chown command to be your user.

If this doesn't meet your needs, setting up a ruby environment management tool is also +1 in my book.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .