Uninstalling Ruby on Rails from Mac

Ruby can be an extremely adaptable, concise terminology which has a rampant proliferation of libraries and popular frameworks like rails. However, making use of your system’s default ruby to set up gems is an instant course into dependency nightmares, as different gems attack to make use of different variations of the same collection.

I’ll walk you through how to prevent this using rbenv, ruby-build, and bundler. Towards the end, you’ll have an improved knowledge of where ruby lives on one’s body and you’ll likewise have a stable, adaptable ruby set up that can develop with new development while concurrently providing a bulletproof runtime environment for existing applications and tools.
Questions Before we Begin

What about RVM?

RVM is another tool that purports to ease ruby’s dependency issues. Having used both rvm and rbenv on OSX, CentOS, and Ubuntu, I find rbenv to be simpler and even more reliable.

I curently have some ruby products installed. What do I really do?

Neglect to the “Resetting Your Ruby Unit installation” appendix by the end of the article. Once you’re done, go back here and carry on onward, to glory!

Prerequisites

To be able to set up rbenv and ruby-build you will need git and a c compiler. On *nix you can usually have the c toolchain via the build-essential deal. On Macintosh personal computer, the c compiler originates from Xcode or the CLI tools for Xcode, which really is a much smaller download.

Remove RVM From Apple Mac OS X

If you want to uninstall/remove RVM, it’s very easy. First, run the next commands:

$ rvm implode
$ jewel uninstall rvm

Then just follow the instructions from rvm implode:

  • Delete the next files, if indeed they are present: /etc/rvmrc $HOME/.rvmrc

Also, take away the lines sourcing RVM scripts from $HOME/.bash_account /etc/zprofile and /etc/account.d/rvm.sh if indeed they are present. (A reboot doesn’t harmed after you accomplish this, merely to make sure).

To uninstall Homebrew, run the next:

compact disc `brew --prefix`
brew install libtool
rm -rf Cellar
rm `git ls-files`
rm -r Library/Homebrew Collection/Aliases Collection/Formula Collection/Contributions
rm -rf .git
rm -rf ~/Library/Caches/Homebrew

Cleaning your Ruby Setup On Mac OS

Every once in awhile , i must say i need to completely clean out my mac pc. Because of this new project I needed to truly have a clean unit installation for Ruby and Rails. It will remove all prior installed gems and downloaded libraries so that we now just what will happen.

The recommend way is to perform jewel cleanup , but as you might have guessed it didn’t work immediately. See what took place…

$ sudo jewel cleanup
Clearing up installed gems…
Wanting to uninstall mongrel-1.0.1
Mistake: While performing gem … (Gem::InstallError)
Unknown jewel mongrel = 1.0.1

Description of the error

Why would this give me one? Well it appears that on MacOSX (Leopard) there are multiple locations for your gems. You could suggest to them with

$ sudo jewel environment
RubyGems Environment:

GEM Pathways:
/Collection/Ruby/Gems/1.8
/Users/patrick/.jewel/ruby/1.8
/System/Collection/Frameworks/Ruby.platform/Versions/1.8/usr/lib/ruby/gems/1.8
….
In /System there will be the gems that was included with basic vanilla Leopard. Which is what can cause the rather cryptic problem. It actually means that system gems can’t be uninstalled.
/Library will contain additional System extensive installed gems
/Users/…/.jewel/… will support the consumer installed gems

So the problem actual is the fact you can’t uninstall the machine gems with the jewel cleanup order, and the problem is quite cryptic.

Instructions to Uninstall All Ruby Gems

Keeping in mind the end goal to uninstall all pearls, you need to circle through all sections in diamond list with bash scripting. This strategy is extremely inconveninent. Because of Rubygems 2.1.0, you presently could do it with one summon.

Right off the bat, if it’s not too much trouble ensure you redesign your Rubygems to 2.1.0 or more up to date:

gem update --system
gem --version

# 2.1.8

what’s more, with a specific end goal to uninstall all gems:

gem uninstall --all

That is it parents!