Follow-up on Ruby on Rails

In my previous blog, I mentioned that grep was no longer working after removing all of /sw to get rid of fink.

To resolve that problem, I used MacPorts (port) to perform a full self-update. That took quite a long time. Then I used port to install grep. That took a long time. With /opt/local/bin in PATH before /usr/bin, the new grep works just fine.

Advertisements
Posted in Uncategorized | Tagged | Leave a comment

Ruby on Rails

For the past few days I’ve been trying to install and use Ruby on Rails. My platform is a 15″ MacBook Pro Retina OS X 10.8.4 with 16GB of memory.

First and foremost, before attempting anything else, the latest Xcode and the developer tools need to be installed. Since this post isn’t a ‘how to,’ I’m not going into detail about that.

Now pay attention here. I had previously installed fink, MacPorts, ruby, Python, and many, many other tools. It should be noted that this is a major cause for problems in installing Ruby on Rails.

The process for installing Ruby on Rails is not a difficult one or a very complex one, but it does require following a pretty strict process of about 10 or so instructions available here. If you follow the breadcrumbs carefully, it will lead you to this location for installing RVM, which is where you should start. Since I wanted to install Ruby on Rails, I chose this command:

\curl -L https://get.rvm.io | bash -s stable --ruby=jruby --gems=rails,puma

Please note that in the page from the above referenced link that there are three ways to install and configure RVM. Be careful to follow all the instructions on that page and do as much as needed before attempting to work on your first Ruby project.

At first, I was unable to install rvm 2.0.0. The error message indicated that it was probably because I had MacPorts and/or fink installed. I was able to install 1.9.3, which then allowed me to install ruby 2.0.0 followed by rails. I managed to create a test rails and it seemed to work okay. So I decided to try to do something about fink so I could install rvm 2.0.0.

I discovered that .bashrc had several lines for setting the environment for fink. Once I removed those settings,  I was able to install rvm 2.0.0. But then afterwards, neither rvm, ruby, nor rails would work. So I thought I should start all over and reinstall rvm, ruby, and rails.

With a little sleuthing regarding removing fink, I discovered that all of /sw needed to be removed. Note that after removing all of /sw that some Unix commands will no longer work, like grep. So that really bothers me. Then, with some help from github.com, I found the secret for removing all of rvm, ruby, and rails so I could start from scratch. I’ll post the entire instruction here as provided to me by Michael Papis of github.com (with some of my own edits for clarification):

==== Start ================

It depends where you installed rvm, in most cases it is not required to start over, you can clean everything from rvm … anyway here is command to clean rvm:

rm -rf ~/.rvm

then you need to close your terminal and open it again, check if rvm is gone:

env | grep rvm

if it shows any rvm variables then you need to try again after computer restart, 
in rare cases if rvm was installed in system then you remove it with sudo rm -rf /etc/rvmrc /etc/prfile.d/rvm.sh /usr/local/rvm and restart computer.

There are some issues with github, so you might need to use the following instead:

git clone https://github.com/wayneeseguin/rvm.git; 
cd rvm; git checkout stable ; 
./install ; cd ..; rm -rf rvm

Make sure to read the outputs, it provides important information and gives you warnings when something is wrong.

After you got rid of old rvm install it again (best as user):

\curl -L https://get.rvm.io | bash -s stable 

 ==== End ================

And don’t forget to open a new Terminal to get the new environment before starting the reinstall, and then after the reinstall, don’t forget to open a new Terminal to get that new environment.

Still, even after all that, the one command that I need to run to use ruby is ‘rvm use 2.0.0’ and it didn’t work. And I found out why. I hadn’t yet completed all the installation instructions.

So, thinking that since ‘grep’ no longer works, maybe I should update MacPorts. And even that failed:

rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(1400) [generator=2.6.9]
Command failed: /usr/bin/rsync -rtzv --delete-after rsync://rsync.macports.org/release/base/ /opt/local/var/macports/sources/rsync.macports.org/release/base
Exit code: 23

Wow! Can’t seem to do anything right!

Anyway, by following all the instructions given here, the command ‘rvm use 2.0.0’ finally worked and I decided to start a new ruby project:

$rails new blog

And it worked!

And all this just because I’m curious about using Ruby on Rails for web development and such. At 73 years old, why do I bother? Because I’m curious.

More to follow – someday.

Posted in Uncategorized | Tagged , , , , , , , , , , , | Leave a comment