I'm sitting here with a cPanel server, and I want to uninstall ruby, and ruby on rails.
I can see there is /scripts/installruby, but not a remove.
Does anyone know how I can uninstall ruby and rails from my server? So I can free up the space given I don't use it anyway?
Please note that I do have full root access to the server!
It depends on what you run. If Ruby was installed through a packet manager like apt you can simply use that to uninstall it.
apt-get remove ruby
If the ruby install was a build from source you obviously either want to find the sources and do a make uninstall or you simply delete the folders where ruby is at (which ruby gives you the paths)
Ruby on Rails is only a gem inside ruby - so deleting the ruby folder with the gem folder in it will also remove rails. Make sure to clean up your path of any references to the ruby/bin and gem/bin folders and you should be good.
Then you have to figure out what application server was running ruby on your box. And uninstall those seperatly (passenger, unicorn, mongrel etc)..
Related
I want to upgrade our Ruby version and a bunch of gems on our production website that we are currently running. We use RVM to manage our Ruby versions and gemsets.
I know how to install a new Ruby version using RVM and install gems in a gemset. I also understand that if I run bundle install it will install my gems into the Ruby version I am running the command from.
Is there some way to pre-create a Ruby version with a gemset in it and then swap my production site to use this new Ruby version and gemset? I know this can be done manually, but is there anyway to do it with a gemfile?
Yes, you can specify the Ruby version in the Gemfile:
source 'https://rubygems.org'
ruby '2.1.3'
This allows you to set the version that would be used if you deploy to Heroku, for example. Your question does not detail your production environment, so it's not clear if it can use the Ruby version in the Gemfile.
Locally, the app will run against whichever Ruby version is active with RVM. The only way to know if it will work is to run the specs against the new Ruby version. Your question did not mention specs, but if you have a complete set of specs then this is the proper way to find out if the new Ruby version will work.
You can install new versions of Ruby and gem sets all day long without it affecting a running application. Once an application is running, it continues running under the same version of Ruby the entire time.
You can have RVM install new Rubies, manipulate gemsets, etc., as long as you don't remove the version of Ruby the application needs. If the binary disappears your app might crash/lock-up if the system needs to load something that has been deleted.
This totally depends on your setup. I am anwsering for a Passenger/Apache setup.
With Passenger and Apache, you can set my PassengerRuby in the Apache Vhost file so it uses that particular version of Ruby, I would set it to your current ruby path and restart Apache like so:
PassengerRuby <path-to-ruby>
Then you you can install your new ruby version and gems, once you install everything you can change the PassengerRuby to the new ruby path and restart Apache. This should migrate your Ruby version smoothly, since you can always fallback to your old Ruby version.
I'm a new Rails developer. I recently took a class on Rails and now I'm trying to make sure I'm growing in my skill by self-assigning projects that push me. One thing I'm trying to do now is use Radiant CMS to build a blog site. However, I'm running into some problems downloading the Radiant gem. Here's what I did:
When I first tried gem install radiant, it installed most of the required gems but then threw a warning (which I unfortunately did not save verbatim), which was along the lines of:
railties executable will overwrite rails executable. Overwrite? Y/n
Stupidly, I chose "Y". As soon as I did I tested my rails gem by writing rails new testproject and it failed. So I then re-ran gem install rails, told it to overwrite the "railties" executable, then ran gem uninstall radiant to get rid of the core radiant gem (although I do still have railties).
Now, my Rails gem is fixed, and I can create new Rails projects without an issue. However, I reinstalled the Radiant gem, and while it installed, it fails to create a project every time I run it.
I'm pretty sure I broke something, but I'm not terribly concerned about that. What I am concerned about is the fact that it seems that the Radiant gem doesn't really coexist well with the Rails gem, which leads me to my question:
Is there any way to create separate, self-contained ruby gem environments where the current Ruby version will only use the gems in the specified environment?
In essence, I'm looking for what rbenv does, but for collections of gems rather than Ruby versions.
Currently, I have Homebrew installed and I am using rbenv as my version manager. Everything I can find so far talks about managing gems on a project-by-project basis; I'm looking for something that will manage and keep separate the gems that create the projects in the first place. So, for example, environment_a contains rails and httparty while environment_b contains radiant and railties.
I'm not above completely obliterating rbenv and all of my gems and starting from scratch, either, so that's a possibility (and an advantage of being a noob).
You should check bundler, as it does exactly what you need.
Yes: rbenv-gemset
I think that it is better than RVM because it is less invasive.
I have been using rbenv and rbenv-gemset for about 2 years and find it easy to use. It makes it easy to encapsulate the Ruby and gemset in a project, run multiple Rubies and gemsets on one machine, and move a project to another machine.
You can use ruby-build to install other versions of Ruby. There is a trick to installing the latest versions of Ruby.
You may want to have a look at How do I ensure ruby gems are installed in right place to be executed by bundler? It has some relevant (and hopefully useful) info.
Yes, there is.
I think that it's called RVM.
Just like Chris Heald said, You can check more information about it # rvm.io/gemsets/basics
I'd recommend bundler for versioning gems although both RVM and rbenv also have this functionality.
You asked: "Is there any way to create separate, self-contained ruby gem environments where the current Ruby version will only use the gems in the specified environment?"
The best way to do it with rvm is entering your project's directory and then run:
rvm use ruby-x.y.z#your_project_name --ruby-version --create
where x.y.z is your Ruby version for that project, previously installed with rvm install x.y.z
For example, to use the newest Ruby version with a project named acme you would use
rvm install 2.3.1
and then
rvm use ruby-2.3.1#acme --ruby-version --create
This command would create two files in the projects directoty: .ruby-version and .ruby-gemset.
The file .ruby-version would contain just the version number. And the file .ruby-gemset would contain only the name off the gemset, the same name of your project (acme).
It happens that rvm is smart enough to check for these files and use the gemset specified, which will be located at ~/.rvm/gems/ruby-2.3.1#acme and your gems will be located at ~/.rvm/gems/ruby-2.3.1#acme/gems.
Some points:
1) Using your project's name as the gemset name is NOT mandatory. You may use anything you like. It's kind of a standard using project's name, but not mandatory.
2) rbenv probably has a way to do the same, but I don't use rbenv and really don't know how to do that.
Hope this answer helps.
This is a beginner-level question.
I'm using Ubuntu 12.04
I copied a project (created on Rails 4 using the rails new command) from Dropbox to my local environment, where I have previously install Rails 4 and up-to-date Ruby and RVM, went to project's directory, typed rails server and got
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
I ran gem install rails instead.
Will I have to run gem install rails on every project's directory? I thought the Rails install was a general and accessible on my whole environment.
The project was created using the same Ruby version, but on a MacOS X system.
The project is a static web brochure and has no database configuration.
Thank you in advance.
Make sure you're using the correct version of Ruby - the same version that you'd installed Rails into - with rvm list.
You likely have two of them (since you have such an issue) - the system Ruby and the RVM-installed Ruby. And likely RVM didn't engage and hook up the correct path to the rails executable, thus the error.
This should fix the issue:
rvm use whatever-ruby-you-had-installed-rails-into
Where whatever-ruby-you-had-installed-rails-into is a string like ruby-2.1.0-p0 taken from the rvm list output.
To make RVM retain Ruby version for the project.
echo whatever-ruby-you-had-installed-into >.ruby-version
in your project's path.
So after a few hours of testing, reproducing the problem, and reading (the other answers inclusive) I got the solution as follows:
Short answer: No. Rails needs to be installed only once.
Long answer: This problem occurred because of a default setting on Terminal that prevents the system from using RVM installations of ruby and rails. The solution is to integrate RVM with gnome-terminal as described in the RVM website.
With terminal window active, go to the menu at the top bar
Edit > Profile Preferences > Title and Command tab
Check the Run command as a login shell box
Restart Terminal and make sure your gemset and ruby version are set
rails server should now work as expected (you might be prompted to run bundle install before Rails can actually run fine, follow the promtp).
I am still learning to work with Ruby on Rails, so any inputs, clarifications, or additional information on the issue is more than welcome.
You don't have to install Rails on every project, but the gems that you need for that project.
With bundle install you install all the gems that you specify in Gemfile.
If you want to avoid reinstall the gems every time you change project, I suggest you to have a better look to RVM: it has got an opt called gemset (https://rvm.io/gemsets), if you use it you just need to switch your gemset:
rvm gemset use yourgemset
I hope it can help you.
Have had 1.9.3p194 (RubyInstaller) with Ruby on Rails and all kinds of Gems installed on my WinXP. Now I want to update the whole setup.
Updating RoR (to 4.0.0) and gems was easy: gem update rails, gem update --system, gem update.
But how do I do that with Ruby? Is there an easy way to update the installation?
If not, and I have to install the fresh package, then how do I do it with little hassle?
I have downloaded the fresh 2.0 RubyInstaller. I have read that I shouldn't install this new Ruby version in the same directory as my old Ruby version (c:\programs\Ruby) that's why I chose a c:\programs\Ruby200 directory. During the installation I clicked on every additional setting, including the "include new directory in the PATH variable" type of choice. But now when I type ruby -v I still get 1.9.3p194 and the new directory is absent from PATH (I haven't rebooted, so maybe this has something to do with it).
So how should I really install the new version? Should I simply change the old PATH to the new one? Or should I instead only add the new one without removing the old path (so there will be some kind of advantage of having both 1.9.3 and 2.0)? Or should I simply delete both installations and install 2.0 from the start?
How do I easily transfer the gems (or the list of them, so the gem update could handle the installation/updating) from my old installation to the new one?
I am using JetBrains RubyMine 5.4 editor, and would like to know if I need to do something there as well (for both the new and the existing projects).
Like many POSIX users, I rely on rvm and bundler to manage ruby versions & gemsets. Unfortunately, rvm is not available on windows. Although I haven't tried it personally, it looks like pik is a viable windows alternative. I would recommend checking that out.
You should also definitely look into bundler if you're not already using it; since bundler is just a gem, it should be platform independent.
I set up RVM and used it to install Ruby and a few other libraries. As I was going through various tutorials and set-ups of other technologies like Rails, I began getting confused about what I should do via RVM and what I should just do as the tutorials suggest.
One example is the RubyGems tutorial here:
http://rubygems.org/pages/download
Should I download that tar file they are talking about? Seems unnecessary since that is what I thought RVM was for. Do I even need RubyGems? What is that for really?
Also, how do I actually get Rails? Is there a precise RVM command to actually download and install Rails?
It helps me to think of RVM as a layer of abstraction between you and the ruby ecosystem.
Without RVM: ruby, gems, and ruby related binaries (like rake, spec, gem, etc) are all installed directly into your operating system directories.
With RVM: ruby related stuff is intercepted by rvm so that ruby, gems, and ruby related binares are "installed" into ~/.rvm dir in a nice, clean, organized way. RVM sits between ruby, gems, and related binaries and the operating system. It provides a way to have multiple ruby environments (with different gems and binaries) on the same machine.
So, no matter whether you have rvm installed or not, you should be able to run the commands almost exactly(*) as they appear in any tutorials out there on the web. In other words, you can sort of "forget" that RVM is installed; the ruby ecosystem should work just as if it wasn't installed.
So, yep, you're gonna have to run gem install rails, etc.
Hope that helps clear the confusion.
(*) There are some small differences. For example: you shouldn't run commands as sudo when RVM is installed.
Should I download that tar file they are talking about?
No. Ruby 1.9+ includes gems. RVM retrofits it for 1.8+.
In general, be careful with any directions you find on the internet explaining how to install anything, unless you have enough experience to understand completely what they want you to do. In particular, any time they want you to install something using sudo or as root.
Specifically, when working with RVM, you do NOT want to use sudo to install Ruby, or any gem. RVM works by setting up a sandbox for your development, and relies on your account's environment, modifying your path so any Ruby requests go to the currently selected RVM-managed Ruby or gems or any commands they install. sudo pushes your normal environment to the side, substituting root's temporarily, installs whatever you asked it to do with root's permissions, then reverts to your environment.
When you go to run the command, or find the gem, as you, it can't be found by RVM's Ruby, because the file was installed outside RVM's sandbox, or, it can't be read or modified, because it's owned by root. Whatever the actual cause, the end result will be weeping and gnashing of teeth.
RVM doesn't subvert the gem functionality. gem is used to install and manage Ruby gems, and RVM tweaks it to use the sandbox for all its machinations. You get added functionality because of RVM's support of gemsets, but gem works as it always has, only it has "big brother", RVM, controlling its world.
No need to install rubygems. RVM should have already installed rubygems. RVM is (in my opinion) useful for managing different installations of ruby (say 1.8.7 and 1.9.2) or different gemsets. If you just have one version of ruby and don't care about different gemsets, RVM isn't really that much of a change. If you want to just install rails, just use gem install rails. If you have an existing rails 3 app, install bundler first gem install bundler and then bundle install to get rails and other gem dependencies.