Why does Mac OS X come with ruby and ruby on rails pre-installed? Does the OS actually use it at all? Can I update my Ruby, Rails or Gem versions safely without something spitting the dummy?
(on Mac Intel) or /opt/homebrew/... (for Apple Silicon). The version of Ruby installed by Homebrew is primarily intended for use by other Homebrew packages. As such, it can be updated to a newer version without warning when Homebrew updates the dependencies of other packages.
First of all, Ruby is already pre-installed on your Mac. However, the pre-installed version is a few versions behind so we'll look into the other ways to install Ruby. Using a package management system makes your life easier when installing any software. On a Mac, you can use Homebrew to install newer versions of Ruby.
ruby-build is a plugin for rbenv that allows you to compile and install different versions of Ruby. ruby-build can also be used as a standalone program without rbenv. It is available for macOS, Linux, and other UNIX-like operating systems.
Uninstall Ruby on Mac with rbenv For rbenv, use rbenv versions to see which versions you have installed. Use the uninstall command to remove a version. This will remove any gems associated with the version as well. If you want to reinstall Ruby, see Install Ruby on Mac for recommendations of newer version managers.
As others have noted, OS X comes with various open source packages pre-installed. While this can be a nice convenience, the packages often are only updated to new versions as part of a major OS X release (like 10.5 to 10.6). Also, some packages are used elsewhere by other parts of OS X and there is no easy way to know which. In general, Apple assumes (and you should, too) that everything under /System/Library
and /usr/
, except for /usr/local/
, is part of OS X and is administered by Apple. You should not attempt to remove or modify files in those hierarchies. That includes just about all of the open source packages, including Ruby
.
Instead, to upgrade an existing package, the right approach is to install a new version in a separate location (say, /usr/local/
) and invoke the new version by an absolute path reference (/usr/local/bin/ruby
) or manipulating the shell PATH
environment variable, if necessary. /usr/local/
is often used if installing directly from source. Many people prefer to use one of the 3rd-party open source package distributors, such as MacPorts, Fink, or Homebrew, each of which has its own package manager and installation locations.
No the OS does not use, it is just that Apple wants to make her products a bit more appealing to developers. (there is also Python preinstalled along with some other packets).
You can safely update your Ruby, Rails, Gems but the default Ruby version is a bit outdated. Check RVM so that you can install different Rubies in your system
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With