I just got a new MacBook Pro and would like to install / upgrade the the Ruby on Rails stack specifically. My question is whether I should sudo all the installs / upgrades. The usual suspects of what I plan to install / upgrade are: Ruby, Gems, Rails, MySQL, sqlite3, PostgreSQL, RVM, Nginx, Passenger. I understand that RVM can be installed with different levels of access, root vs admin user, etc. Anyone knows what's the preferred way of installing RVM?
UPDATE
I know that LAMP isn't RoR, I just thought it was more inclusive seeing that it included web server, database, etc. Anyway, my bad, I have removed it from the post to avoid confusion. I have installed all the various components before, so this isn't a question about how to install them, this is a question about if I should install them as root or just the usual admin user.
Apache comes installed; edit the configuration file here: /private/etc/apache2/httpd.conf. To start/stop apache, open your System Prefrences.app, go to Sharing, and click the checkbox next to Web Sharing.
For MySQL, simply download the dmg and install http://dev.mysql.com/downloads/mysql/
sqlite3 comines installed
PostgreSQL: http://www.postgresql.org/download/macosx
How to install RVM: http://rvm.beginrescueend.com/rvm/install/
Update your ruby gems: sudo gem update --system
Update rails: gem update rails
Bonus: Awesome package manager for MacOS: https://github.com/mxcl/homebrew. You don't actually need this for the things you listed above, but I would highly recommend this if you plan on compiling/installing any additional packages on your system. (You'll need to install Xcode for this.)
PS: You don't actually mean "LAMP" as the P stands for PHP.
I know this is a little old, but the same concept applies. Excellent tutorial on how to do what you're asking for the best way.
Hivelogic Tutorial
Related
So I wish I had known far before that installing Rails with sudo was a bad thing. In fact, after doing my research, it appears that most people would agree that installing any type of package manager as sudo is a big no-no.
Unfortunately for me, I found this out a bit too late. I have several Rails applications that I have created and I am worried that If I try to reinstall Rails with RVM that my applications will not work because of dependency issues.
When I would install gems with bundle install, if the gem was new, Rails would ask for my password before installing it. I did not think much of it at the time, but now, I am worried nothing will work after I try booting a Rails app.
So my questions are:
If I installed Rails with sudo, will my applications still work if I reinstalled it under RVM?
If they don't work, what would I need to make them function correctly?
How do I remove a Rails installation that was installed with sudo?
Is this issue as severe as I think it is?
I had seen a lot of related posts about why one should not use sudo to install gems and Rails in general, as well as why not to do it with RVM, and pretty much not to do it all with anything Ruby related. But I have not seen a post that really addresses any of my concerns and questions that I mentioned above.
No it's not severe as you think. Applications are meant to be portable (somewhat), once you have the same dependencies installed as your development machine, they are meant to work again otherwise you wouldn't be able to deploy.
Now the main thing to check is that all your files in your rails applications are owned by user and not by sudo (otherwise you won't be able to read them later on).
Aside from it, you can simply install rvm, ensure with which ruby and which gem comes from rvm and not from your packaged ruby installation (which you can remove, I do this usually) and then simply run bundle install in your rails application, at that point they are ready to start again.
I've spent some time in web development and since I have decided that ruby is quite a nice language to code in I want to try the reason why some people say ruby got known : Rails
I installed rails in my linux machine however I am now trying to develop it in Windows. I know that it was recommended to install rails using RVM in linux however I'm not sure what is the best way to install it in Windows since I've read articles which said that
gem install rails
is a method which will cause you lots of bugs in both linux and windows
My question to you is what is a method which is "bugless" to install rails in windows?
Is
gem install rails
actually buggy?
Yeah, installing Rails on Windows is a little more complicated, but that's why they have bundles for it.
Go here and follow instructions.
http://railsinstaller.org/en
I currently use rvm on my dev box (osx) but I use the system ruby on my server (1.8.7 on Ubuntu 10.04)
I want to upgrade the server to 1.9.3 and have been researching the best way to do it.
The server is running about four Rails applications all on version 3.2.11.
My options appear to be using rvm or alternatively using the 1.9.3 deb package and the ruby-switch gem provided by BrightBox (who also provide passenger packages)
The Brightbox packages appear to be a clean way to go but I thought I would ask a question here to see if there are any advantages or disadvantages of either approach that I have not thought about.
Rvm is useful when you need to have two or more versions of Ruby on the same machine. Development machines tend to have this. There is no need to use a version manager if your production box only requires one version of Ruby.
To this effect, I'd suggest you're correct in doing a single installation from the deb package. I can see the ruby-switch gem gives similar functionality to rvm - up to you as to whether that's important. But if you're using three apps on the same version of ruby, it may not be!
I've recently started teaching myself Ruby on Rails, and it's all going well except I'm looking to completely reinstall Ruby, Rails and Gem.
I think I got a bit too excited at some point and deleted/modified some files or folders I shouldn't have, so I just want to get my system back to its original state so that I can reinstall the necessary Ruby, Rails and Gem bits.
I've read in places that I can install something called rvm to do this, but right now I just want to keep my system as simple as possible so that my understanding can keep up.
Any help would be appreciated.
Many thanks.
You list all the gems which are installed in your user account, with:
gem list
You can then delete any of the gems, by doing this:
gem uninstall GemName
... until gem list doesn't show any installed gems.
After that, everything should be as good as new.
I would highly recommend to install RVM, because it will help you not to get into the same situation in the future. With RVM you can create "gemsets" to keep the gems for each project separate from other projects.
With RVM you can also install different versions of Ruby, such as the newer Ruby 1.9.2
Check it out! It's really not difficult to install
http://beginrescueend.com/
Check these RailsCasts:
http://railscasts.com/episodes/200-rails-3-beta-and-rvm
http://railscasts.com/episodes/201-bundler
If you are on Max OSX 10.5 and up, Ruby and RubyGems is installed with Developer Tools.
On older versions you could uninstall by running this command:
$ sudo perl /Developer/Tools/uninstall-devtools.pl
Then you just need to reboot your computer and install Developer Tools again. After that if you want to use RVM follow the instructions here. There are also some OSX specific options you should go over as well.
You could follow the instructions on the RoR site - the download page also includes instructions. Another option is this one click installer from the Ruby OS X project on SourceForge.
If you have a TimeMachine backup available, you could also choose to restore your deleted files instead of reinstalling.
The simplest way is to use rvm to do this. The advantage to this is that everything's installed in a manner that's specifically isolated from the system.
Using the OS or MacPorts/Homebrew provided Ruby is a great way to get going, but it doesn't scale. For the long-haul, it's best to use rvm because it is easier to stay up to date, to install different versions of Ruby, and to switch back and forth with a minimum of pain.
Plus, if you really get sideways you can always rvm implode and start over, which when combined with bundler will make life pretty easy.
I'm used to the One-Click install local environments of MAMP. Is there a Ruby equivalent... a download that you run and instantly get the most current versions of Ruby, Rails, SQLite running locally?
I'm using a Mac, running Leopard, and am aware that all of the aforementioned technologies ship with Leopard (except maybe SQLite). The books that I have reference newer versions and the last thing I need is to try to retrofit a tutorial to work with my version.
And one more less important question: What are "Gems" and is that something that I need to make sure is fully updated too?
Installation is pretty confusing when you first start with Rails! Even though a lot of what you need is already installed if you are using Mac, personally I found it really hard to find come concise information on how to best go about setting things up.
Since I didn't want anyone else to go through the headaches that I had when configuring their Mac development environment, I've written a 7 step guide to installing Ruby on Rails, MySQL, Apache with PHP, and phpMyAdmin on OSX Leopard. In short, everything you should need to get developing locally on your Mac!
Here's the link:
http://waavoo.com/2009/7-step-guide-installing-ruby-on-rails-mysql-apache-php-phpmyadmin-intel-mac-os-x-leopard/
Hope that helps!
Take a look at FiveRuns Install. It's a free Ruby on Rails stack that you can download.
RubyGems is the Ruby standard for publishing and managing third party libraries. Check out the User Guide.
Have fun!
I have no idea what mac os are you in but Leopard (10.5.x) already have ruby installed, all you need is to updated the gems using
gem update rails
in your command line.
if you're on Tiger (10.4.x) the installation is broken, and please follow this link.
You should also have a look at Phusion Passenger - this, along with the prefpane, allows you to have apache VirtualHosts set up the easy way.
Current versions of Rails are designed to work (for development) without needing an AMP -style stack, by using SQLite and a small Ruby Web server, so if you will only be doing Rails development you don't need to set up a stack - you can just type "rails" and it will work.
BUT the versions of RubyGems and Rails shipped with Leopard are now outdated, though, so you'll need to upgrade these before you go too far. There's an article that I wrote on setting up a Mac for development here, but the minimum commands go like this:
sudo gem install rubygems-update
sudo update_rubygems
sudo update_rubygems (yep, twice)
sudo gem update --system
These get RubyGems up to the current release, so that you can upgrade Rails safely. To do that, type:
gem update rails
The last command doesn't have sudo, because if you omit it, current versions of RubyGems will install a clean copy of the gems into your home directory, leaving the system versions untouched.
Finally, amend the .profile file in your home directory, so that the line with PATH in it says:
export PATH=$HOME/.gem/ruby/1.8/bin:$PATH
Close up any terminal windows for this to take effect. The utilities provided by the gem packages in your home directory will now have precedence over the system versions.
This means that you can type "rails" and the latest version will run, but you haven't messed with any of the software provided by Apple (apart from the system copy of RubyGems).
To upgrade your private copy of Rails whenever a new version comes along in future it's just this again:
gem update rails
just refer this....
http://wiki.rubyonrails.org/getting-started/installation/windows#installing_ruby_on_rails_on_windows
BitNami RubyStack is exactly what you are looking for http://bitnami.org/stack/rubystack