Tuesday, October 20, 2015

RoR install on OS X without sudo

There is plenty of advice out there as to how to do this, most of it wrong or too complicated. The short story is one can install everything necessary without sudo, in your home directory. First, make sure your Xcode is ready to go:

xcode-select --install

Then install rails, but only after a successful nokogiri install:

gem install --user-install nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2
gem install --user-install rails

You'll need to fix up your PATH variable to point to what you installed:

export PATH=/Users/beatys/.gem/ruby/2.0.0/bin:$PATH

Now you can create rails apps, again taking care to worry about nokogiri first:

rails new Demo --skip-bundle
cd Demo
bundle config build.nokogiri --use-system-libraries --with-xml2-include=/usr/include/libxml2
bundle install --path vendor/bundle

While it shouldn't be this complex, here we are.

No comments: