-
Notifications
You must be signed in to change notification settings - Fork 618
Ruby on MacOS
recommended => ruby 2.2 # or the most recent version
minimum => ruby 2.0
We recommend you install and use a ruby manager on MacOS for several reasons:
- Apple's version is always several steps behind the most recent version,
- by default, Apple's version requires
sudo
to install gems, - the ruby version on your local machine should match the ruby version in CI, including the ruby version on the Xamarin Test Cloud,
- everyone on your team should be using the same ruby version.
You should never install a gem with sudo.
Using sudo
is inherently dangerous. Executing a gem install
with sudo
is even more dangerous because gems can execute code at install time. This means they could erase parts of your hard drive or publish sensitive information to the internet. Installing gems with sudo
on MacOS can overwrite the pre-installed system gems which could cause internal MacOS and Xcode tools to fail.
Still not convinced? See what others have to say:
- https://robots.thoughtbot.com/psa-do-not-use-system-ruby
- http://stackoverflow.com/questions/2119064/sudo-gem-install-or-gem-install-and-gem-locations
If you are getting started with ruby and Calabash, we recommend the calabash-sandbox
; it will get you up and running with Calabash in minutes.
The Calabash team at Xamarin uses both rbenv and rvm.
rbenv is a system for managing ruby versions.
You can also install rbenv with homebrew.
rvm is another ruby management system.
There are many users who use rvm with success, but we have had some users report problems using rvm + Calabash iOS.
$ gem source -r http://gems.rubyonrails.org
http://gems.rubyonrails.org removed from sources
Avoid installing documentation:
# Create a ~/.gemrc with the following:
install: --no-document --env-shebang
update: --no-document --env-shebang
Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
We recommend that you always use a Gemfile and bundler.