From Zero to Rails: Clean Maverick Meerkat install to working Rails app – Part 2

Last time (and by last time, I mean earlier this evening), I wrote out a skeletal plan for how to install ruby and rails properly on a fresh 10.10 machine. I hadn’t yet tried the instructions, only gathered them from various blogs and searches – here is, step by step, the results of applying the instructions I wrote down earlier. I’ve taken the philosophy that seeing the actual content from the terminal is generally useful, so it’s all here, with explanations when things have gone wrong. The idea is that, next time I do this, I’ll know what the hell is going on.

Step 1:

wcarss@quark:~$ sudo apt-get install curl git-core
[sudo] password for wcarss:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  git libcurl3 libdigest-sha1-perl liberror-perl
Suggested packages:
  git-doc git-arch git-cvs git-svn git-email git-daemon-run git-gui gitk
  gitweb
The following NEW packages will be installed:
  curl git git-core libcurl3 libdigest-sha1-perl liberror-perl
0 upgraded, 6 newly installed, 0 to remove and 3 not upgraded.
Need to get 6,856kB of archives.
After this operation, 14.2MB of additional disk space will be used.
Do you want to continue [Y/n]?

That went well!
Step 2:

wcarss@quark:~$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   986  100   986    0     0   2199      0 --:--:-- --:--:-- --:--:--  7825
Initialized empty Git repository in /home/wcarss/.rvm/src/rvm/.git/
remote: Counting objects: 16345, done.
remote: Compressing objects: 100% (4267/4267), done.
remote: Total 16345 (delta 11025), reused 15855 (delta 10649)
Receiving objects: 100% (16345/16345), 2.92 MiB | 2.02 MiB/s, done.
Resolving deltas: 100% (11025/11025), done.

  RVM:  Shell scripts enabling management of multiple ruby environments.
  RTFM: http://rvm.beginrescueend.com/
  HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)

Upgrading the RVM installation in /home/wcarss/.rvm/
    Correct permissions for base binaries in /home/wcarss/.rvm/bin...
    Copying manpages into place.

Upgrade Notes

  * rvm_trust_rvmrcs has been changed to rvm_trust_rvmrcs_flag for consistency
  * Ruby package dependency list for your OS is given by:
    rvm notes
  * If you encounter any issues with a ruby 'X' your best bet is to:
    rvm remove X ; rvm install X
  * If you wish to have the 'pretty colors' again, set in ~/.rvmrc:
    export rvm_pretty_print_flag=1
  * If you see the following error message: Unknown alias name: 'default'
    re-set your default ruby, this is due to a change in how default works.

WARNING: You have RUBYOPT set in your current environment.
This may cause rubies to not work as you expect them to as it is not supported
by all of them If errors show up, please try unsetting RUBYOPT first.

Upgrade of RVM in /home/wcarss/.rvm/ is complete.

wcarss,

Thank you very much for using RVM! I sincerely hope that RVM helps to
make your work both easier and more enjoyable.

If you have any questions, issues and/or ideas for improvement please
join#rvm on irc.freenode.net and let me know, note you must register
(http://bit.ly/5mGjlm) and identify (/msg nickserv  ) to
talk, this prevents spambots from ruining our day.

My irc nickname is 'wayneeseguin' and I hang out in #rvm typically

  ~09:00-17:00EDT and again from ~21:00EDT-~23:00EDT

If I do not respond right away, please hang around after asking your
question, I will respond as soon as I am back.  It is best to talk in
#rvm itself as then other users can help out should I be offline.

Be sure to get head often as rvm development happens fast,
you can do this by running 'rvm get head' followed by 'rvm reload'
or opening a new shell

  w⦿â¿â¦¿t

    ~ Wayne

wcarss@quark:~$

hmmm, I’ve got a warning now that I have the environment variable RUBYOPT set; it’s set to “rubygems”, and the rvm docs recommended that I unset it. I’m going to proceed without doing so, and hopefully things are fine.

Step 3:

vim .bashrc

huh, it already has [[ -s “$HOME/.rvm/scripts/rvm” ]] && source “$HOME/.rvm/scripts/rvm” in it! This is pretty strange; but I’m happy. I also (fortunately) don’t have any return statements floating in my .bashrc, so I’m going to proceed to the next step.

Edit: Here is where I must insert this. It’s a week later, about 3 AM on the day after boxing day. I’ve just been trying to use heroku, and it turns out I was lacking several things in ruby because of some small errors I made at this step. I’ve had to uninstall ruby 1.9.2, install some libs and packages, and now I’m able to reinstall 1.9.2 and proceed. The following line of sudo apt-getting is not enough; in the ‘rvm notes’ above, they listed a bunch of things to install. I would suggest that you just do as they say, exactly. Install or update all of those packages, and that should be your step 4. Then, most of the craziness I deal with later on won’t happen to you. Good luck.

Step 4:

wcarss@quark:~$ sudo apt-get install libruby1.8 zlib1g-dev libssl-dev libreadline5-dev build-essential
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version.
The following extra packages will be installed:
  libncurses5-dev libreadline5
The following NEW packages will be installed:
  libncurses5-dev libreadline5 libreadline5-dev libruby1.8 libssl-dev zlib1g-dev
0 upgraded, 6 newly installed, 0 to remove and 3 not upgraded.
Need to get 6,170kB of archives.
After this operation, 23.5MB of additional disk space will be used.
Do you want to continue [Y/n]?

Went well!

Step 5:

wcarss@quark:~$ rvm install ruby-1.9.2

A RVM version 1.1.6 is installed yet 1.0.14 is loaded.
 Please do one of the following:
  * 'rvm reload'
  * open a new shell
  * source your shell init scriptswcarss@quark:~$

Whoops! I was supposed to run ‘source ~/.bashrc’ first – let’s do that.

Step 5 (fo realz):

wcarss@quark:~$ source ~/.bashrc
wcarss@quark:~$

No output: means all is well!

Step 6:

wcarss@quark:~$ rvm install ruby-1.9.2

A RVM version 1.1.6 is installed yet 1.0.14 is loaded.
 Please do one of the following:
  * 'rvm reload'
  * open a new shell
  * source your shell init scriptswcarss@quark:~$

Huh. I’ll try ‘rvm reload’, and if that doesn’t work, I’ll log out and back in.

Step 6 Redux:

wcarss@quark:~$ rvm reload
wcarss@quark:~$ rvm install ruby-1.9.2
/home/wcarss/.rvm/rubies/ruby-1.9.2-p0, this may take a while depending on your cpu(s)...

ruby-1.9.2-p0 - #fetching
ruby-1.9.2-p0 - #extracted to /home/wcarss/.rvm/src/ruby-1.9.2-p0 (already extracted)
ruby-1.9.2-p0 - #configuring
ruby-1.9.2-p0 - #compiling
ruby-1.9.2-p0 - #installing
ruby-1.9.2-p0 - updating #rubygems for /home/wcarss/.rvm/gems/ruby-1.9.2-p0@global
Error running '/home/wcarss/.rvm/rubies/ruby-1.9.2-p0/bin/gem update --system', please read 

/home/wcarss/.rvm/log/ruby-1.9.2-p0/rubygems.update.log
ruby-1.9.2-p0 - updating #rubygems for /home/wcarss/.rvm/gems/ruby-1.9.2-p0
Error running '/home/wcarss/.rvm/rubies/ruby-1.9.2-p0/bin/gem update --system', please read 

/home/wcarss/.rvm/log/ruby-1.9.2-p0/rubygems.update.log
ruby-1.9.2-p0 - adjusting #shebangs for (gem).
ruby-1.9.2-p0 - #importing default gemsets (/home/wcarss/.rvm/gemsets/)
Install of ruby-1.9.2-p0 - #complete
wcarss@quark:~$

Woohoo! ‘rvm reload’ did the charm. This process took about 4-5 minutes on my 6-7 year old 2GHz AMD64. Next up: 1.8.7.
Editor’s note: I didn’t notice the errors the first time I went through this; some of the problems I’ve got a bit later might have been detectable here.

Step 7:

wcarss@quark:~$ rvm install ruby-1.8.7
/home/wcarss/.rvm/rubies/ruby-1.8.7-p302, this may take a while depending on your cpu(s)...

ruby-1.8.7-p302 - #fetching
ruby-1.8.7-p302 - #downloading ruby-1.8.7-p302, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 4086k  100 4086k    0     0   282k      0  0:00:14  0:00:14 --:--:--  428k
ruby-1.8.7-p302 - #extracting ruby-1.8.7-p302 to /home/wcarss/.rvm/src/ruby-1.8.7-p302
ruby-1.8.7-p302 - #extracted to /home/wcarss/.rvm/src/ruby-1.8.7-p302
ruby-1.8.7-p302 - #configuring
ruby-1.8.7-p302 - #compiling
ruby-1.8.7-p302 - #installing
ruby-1.8.7-p302 - #rubygems installing to ruby-1.8.7-p302
Retrieving rubygems-1.3.7
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  284k  100  284k    0     0   217k      0  0:00:01  0:00:01 --:--:--  251k
Extracting rubygems-1.3.7 ...
ruby-1.8.7-p302 - adjusting #shebangs for (gem).
ruby-1.8.7-p302 - #importing default gemsets (/home/wcarss/.rvm/gemsets/)
Install of ruby-1.8.7-p302 - #complete
wcarss@quark:~$

Wicked! Again, a bit over 5 minutes on my aging box. This is working well so far — *knocks on wood* — gonna set 1.9.2 to default:

Step 8:

wcarss@quark:~$ rvm use ruby-1.9.2 --default
Using /home/wcarss/.rvm/gems/ruby-1.9.2-p0
wcarss@quark:~$ 

Easy!

Step 9:

wcarss@quark:~$ sudo apt-get install sqlite3 libsqlite-dev sqlite-doc sqlite3-doc
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libsqlite0-dev' instead of 'libsqlite-dev'
The following extra packages will be installed:
  libsqlite0 libsqlite0-dev sqlite
The following NEW packages will be installed:
  libsqlite0 libsqlite0-dev sqlite sqlite-doc sqlite3 sqlite3-doc
0 upgraded, 6 newly installed, 0 to remove and 3 not upgraded.
Need to get 3,248kB of archives.
After this operation, 10.9MB of additional disk space will be used.
Do you want to continue [Y/n]?

I added a few suggested doc packages. Here comes the scary part.. adding gems.

Step 10:

wcarss@quark:~$ gem install sqlite3-ruby
/home/wcarss/.rvm/rubies/ruby-1.9.2-p0/bin/gem:4: warning: Insecure world writable dir /home/wcarss in 
PATH, mode 040733
ERROR:  Loading command: install (LoadError)
    no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::InstallCommand

Ah, no! This is exactly the kind of crazy bullshit I feared. I’ll turn to the RVM documentation, they suggested tryinh (the risque) ‘rvm get head’

wcarss@quark:~$ rvm get head

Original installed RVM version:

rvm 1.1.6 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]

From http://github.com/wayneeseguin/rvm
 * branch            master     -> FETCH_HEAD
Already up-to-date.

  RVM:  Shell scripts enabling management of multiple ruby environments.
  RTFM: http://rvm.beginrescueend.com/
  HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)

Upgrading the RVM installation in /home/wcarss/.rvm/
    Correct permissions for base binaries in /home/wcarss/.rvm/bin...
    Copying manpages into place.


Upgrade Notes

  * rvm_trust_rvmrcs has been changed to rvm_trust_rvmrcs_flag for consistency

  * Ruby package dependency list for your OS is given by:
    rvm notes

  * If you encounter any issues with a ruby 'X' your best bet is to:
    rvm remove X ; rvm install X

  * If you wish to have the 'pretty colors' again, set in ~/.rvmrc:
    export rvm_pretty_print_flag=1

  * If you see the following error message: Unknown alias name: 'default'
    re-set your default ruby, this is due to a change in how default works.


WARNING: You have RUBYOPT set in your current environment.
This may cause rubies to not work as you expect them to as it is not supported
by all of them If errors show up, please try unsetting RUBYOPT first.

Upgrade of RVM in /home/wcarss/.rvm/ is complete.

wcarss,

Thank you very much for using RVM! I sincerely hope that RVM helps to
make your work both easier and more enjoyable.

If you have any questions, issues and/or ideas for improvement please
join#rvm on irc.freenode.net and let me know, note you must register
(http://bit.ly/5mGjlm) and identify (/msg nickserv  ) to
talk, this prevents spambots from ruining our day.

My irc nickname is 'wayneeseguin' and I hang out in #rvm typically

  ~09:00-17:00EDT and again from ~21:00EDT-~23:00EDT

If I do not respond right away, please hang around after asking your
question, I will respond as soon as I am back.  It is best to talk in
#rvm itself as then other users can help out should I be offline.

Be sure to get head often as rvm development happens fast,
you can do this by running 'rvm get head' followed by 'rvm reload'
or opening a new shell

  w⦿â¿â¦¿t

    ~ Wayne

Installed RVM HEAD version:

rvm 1.1.6 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]
wcarss@quark:~$

Hmm, doesn’t seem to have done anything. But in there, it says “If you wish to install rbx and/or Ruby 1.9 head (MRI) (eg. 1.9.2-head), then you must install and use rvm 1.8.7 first.” — so maybe we need to switch to 1.8.7 as default, run ‘rvm get head’ there, gem install something, and then we can make 1.9.2 work? We’ll give that a try if nothing super-promising comes out of a google search. Didn’t work. Googling “ruby-1.9.2-p0/bin/gem:4: warning: Insecure world writable dir”

*time passes*

Holy crap; it’s been a few hours but I’ve finally got the gorram thing. So, what’s wrong? Actually, two things. First off, let’s fix the ‘insecure directory’ thing. First was that my home directory, /home/wcarss, is world-writable! That’s pretty scary. So I called

chmod go-w /home/wcarss

— this leaves the u (for user, being the owner) setting of the directory with write access, and it removes write access for members of the same groups as me, and for assorted “other” users as well. ‘gem -v’ now just returns ‘1.3.7’ instead of

/home/wcarss/.rvm/rubies/ruby-1.8.7-p302/bin/gem:4: warning: Insecure world writable dir /home/wcarss in 
PATH, mode 040733
1.3.7

Next up: problem 2. This one baffled me a bit longer. The problem arises when calling

gem install sqlite3-ruby

First, let’s clarify that we /do not/ want to use sudo for these gem installs. That isn’t the problem. Second, let’s clarify that whatever we’ve got set as the ‘default ruby’ is what version of gem we’re using — so for me, it’s 1.9.2 right now. While attempting to fix this problem, I switched to 1.8.7 for a while and the command worked well enough there. In 1.9.2 though, the problem persisted. You can specify a particular version to run by saying ‘rvm version command’, so, ‘rvm 1.9.2 gem -v’ will only call the 1.9.2 gem, even if you have 1.8.7 set as your default for the moment. Calling this without the version parameter, like so: ‘rvm gem -v’ will call gem for all installed versions, for me that’s both 1.8.7 and 1.9.2, in order.

Okay, lots of text there, so what in sam hill is wrong?

RVM grabs a source repo of ruby and then compiles it. So, I found a solution early on that matched my problem in a rough sense. It’s a fantastic collection of common ruby install issues and their fixes. It suggested that, if I’d built ruby from source, I should go and make/make install zlib. But to my naive mind, RVM wasn’t the same as installing by source.

Turns out, RVM does build from source, so it’s susceptible to the same issues. The fix to this stage of the problem, that will remove this:

ERROR:  Loading command: install (LoadError)
    no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::InstallCommand

is to do:

cd ~/.rvm/src:
sudo apt-get install zlib1g-dev
cd ext/zlib
ruby extconf.rb
make
sudo make install

It worked as expected! I already had zlib1g-dev, the ruby script ran fine and generated a make file, the make file took about 15 seconds to compile the code, and sudo make install did a quick copy. Then I tried it again:

wcarss@quark:~$ gem install sqlite3-ruby
Building native extensions.  This could take a while...
Successfully installed sqlite3-ruby-1.3.2
1 gem installed
Installing ri documentation for sqlite3-ruby-1.3.2...
Installing RDoc documentation for sqlite3-ruby-1.3.2...
wcarss@quark:~$

Huzzah! Finally, we can move on and try installing rails itself — it has a bunch of dependencies that it installs alongside it, so this is where, if something goes wrong, it’s some distant, barely required gem whose documentation will go insane and cause the install process to fail, borking up the whole environment. But here’s hoping it works okay:

Step 11:

wcarss@quark:~$ gem install rails
Successfully installed activesupport-3.0.3
Successfully installed builder-2.1.2
Successfully installed i18n-0.5.0
Successfully installed activemodel-3.0.3
Successfully installed rack-1.2.1
Successfully installed rack-test-0.5.6
Successfully installed rack-mount-0.6.13
Successfully installed tzinfo-0.3.23
Successfully installed abstract-1.0.0
Successfully installed erubis-2.6.6
Successfully installed actionpack-3.0.3
Successfully installed arel-2.0.6
Successfully installed activerecord-3.0.3
Successfully installed activeresource-3.0.3
Successfully installed mime-types-1.16
Successfully installed polyglot-0.3.1
Successfully installed treetop-1.4.9
Successfully installed mail-2.2.12
Successfully installed actionmailer-3.0.3
Successfully installed rake-0.8.7
Successfully installed thor-0.14.6
Successfully installed railties-3.0.3
Successfully installed bundler-1.0.7
Successfully installed rails-3.0.3
24 gems installed
Installing ri documentation for activesupport-3.0.3...
Installing ri documentation for builder-2.1.2...
Installing ri documentation for i18n-0.5.0...
Installing ri documentation for activemodel-3.0.3...
Installing ri documentation for rack-1.2.1...
Installing ri documentation for rack-test-0.5.6...
Installing ri documentation for rack-mount-0.6.13...
Installing ri documentation for tzinfo-0.3.23...
Installing ri documentation for abstract-1.0.0...
Installing ri documentation for erubis-2.6.6...
Installing ri documentation for actionpack-3.0.3...
Installing ri documentation for arel-2.0.6...
Installing ri documentation for activerecord-3.0.3...
Installing ri documentation for activeresource-3.0.3...
Installing ri documentation for mime-types-1.16...
Installing ri documentation for polyglot-0.3.1...
Installing ri documentation for treetop-1.4.9...
Installing ri documentation for mail-2.2.12...
Installing ri documentation for actionmailer-3.0.3...
Installing ri documentation for rake-0.8.7...
Installing ri documentation for thor-0.14.6...
Installing ri documentation for railties-3.0.3...
Installing ri documentation for bundler-1.0.7...
Installing ri documentation for rails-3.0.3...
Installing RDoc documentation for activesupport-3.0.3...
Installing RDoc documentation for builder-2.1.2...
Installing RDoc documentation for i18n-0.5.0...
Installing RDoc documentation for activemodel-3.0.3...
Installing RDoc documentation for rack-1.2.1...
Installing RDoc documentation for rack-test-0.5.6...
Installing RDoc documentation for rack-mount-0.6.13...
Installing RDoc documentation for tzinfo-0.3.23...
Installing RDoc documentation for abstract-1.0.0...
Installing RDoc documentation for erubis-2.6.6...
Installing RDoc documentation for actionpack-3.0.3...
Installing RDoc documentation for arel-2.0.6...
Installing RDoc documentation for activerecord-3.0.3...
Installing RDoc documentation for activeresource-3.0.3...
Installing RDoc documentation for mime-types-1.16...
Installing RDoc documentation for polyglot-0.3.1...
Installing RDoc documentation for treetop-1.4.9...
Installing RDoc documentation for mail-2.2.12...
Installing RDoc documentation for actionmailer-3.0.3...
Installing RDoc documentation for rake-0.8.7...
Installing RDoc documentation for thor-0.14.6...
Installing RDoc documentation for railties-3.0.3...
Installing RDoc documentation for bundler-1.0.7...
Installing RDoc documentation for rails-3.0.3...

It went smoothly; I’m so proud! Next up, we’ll install mongrel…

Step 12:

wcarss@quark:~$ gem install mongrel
Building native extensions.  This could take a while...
Building native extensions.  This could take a while...
ERROR:  Error installing mongrel:
        ERROR: Failed to build gem native extension.

/home/wcarss/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb
checking for main() in -lc... yes
creating Makefile

make
gcc -I. -I/home/wcarss/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/x86_64-linux -
I/home/wcarss/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby/backward -I/home/wcarss/.rvm/rubies/ruby-
1.9.2-p0/include/ruby-1.9.1 -I.   -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -
Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long  -fPIC  -o http11.o -c http11.c
http11.c: In function âhttp_fieldâ:
http11.c:70: warning: format not a string literal and no format arguments
http11.c:71: warning: format not a string literal and no format arguments
http11.c:77: error: âstruct RStringâ has no member named âptrâ
http11.c:77: error: âstruct RStringâ has no member named âlenâ
http11.c: In function ârequest_uriâ:
http11.c:102: warning: format not a string literal and no format arguments
http11.c: In function âfragmentâ:
http11.c:113: warning: format not a string literal and no format arguments
http11.c: In function ârequest_pathâ:
http11.c:124: warning: format not a string literal and no format arguments
http11.c: In function âquery_stringâ:
http11.c:135: warning: format not a string literal and no format arguments
http11.c: In function âheader_doneâ:
http11.c:172: error: âstruct RStringâ has no member named âptrâ
http11.c:172: error: âstruct RStringâ has no member named âptrâ
http11.c:172: error: âstruct RStringâ has no member named âptrâ
http11.c:174: error: âstruct RStringâ has no member named âptrâ
http11.c:176: error: âstruct RStringâ has no member named âptrâ
http11.c:177: error: âstruct RStringâ has no member named âlenâ
http11.c: In function âHttpParser_executeâ:
http11.c:298: error: âstruct RStringâ has no member named âptrâ
http11.c:299: error: âstruct RStringâ has no member named âlenâ
http11.c:307: warning: format not a string literal and no format arguments
make: *** [http11.o] Error 1

Gem files will remain installed in /home/wcarss/.rvm/gems/ruby-1.9.2-p0/gems/mongrel-1.1.5 for inspection.
Results logged to /home/wcarss/.rvm/gems/ruby-1.9.2-p0/gems/mongrel-1.1.5/ext/http11/gem_make.out
wcarss@quark:~$

Nooooooo! All I wanted to do was install mongrel! Let’s figure out what’s going on here.

*time passes*

Haha, okay. So, it looks like someone upstream buggered mongrel up a bit and left a bunch of “RSTRING(data)->ptr” patterns around when they should have been written as “RSTRING_PTR(data)”. There’s also some malformed case statements. If you go into ~/.rvm/gems/ruby-1.9.2-p0/gems/mongrel-1.1.5/ext/http11, you’ll see our culprit, http11.c. A full explanation of the fix we want can be found here – with a few small edits.
I don’t think the sudo’s are a good idea for us; they’re just there in case you’re working in a system directory. Given that our whole install has proceeded through RVM, which should be inside of your home directory, we’re fine without it. I followed the form on ‘sudo make install’ though, as it feels like a good idea to install things as root. Beyond that, it seemed prudent to run ‘ruby setup.rb’ from within the mongrel-1.1.5 directory, just to make sure that things close off right. So, in succinct form (I’m overlapping with the website I linked here):

cd ~/.rvm/gems/ruby-1.9.2-p0/gems/mongrel-1.1.5/ext/http11
vim http11.c (generally, "RSTRING(data)->thing" becomes "RSTRING_THING(data)")
make the edits suggested at the other site
cd ../../lib/mongrel
vim handlers.rb
fix the case statements from 208-212 (replace ':' with 'then')
gem install gem_plugin (we're avoiding sudo)
cd ../../
ruby setup.rb

And you’re done. Now, let’s test this out. It’s been a bit over 4 hours since I started working on this, so… high hopes. 🙂

Step 13 (ominous!):

rails new example
cd example/
bundle install
rake db:create
rails s

‘new example’ makes a folder called ‘example’ for you, so don’t worry about polluting your space. ‘bundle install’ seems to.. do some kind of magic with gems? I’m not sure. And rake db:create told me that my database already exists:

wcarss@quark:~/code/ruby/testing/example$ rake db:create
(in /home/wcarss/code/ruby/testing/example)
db/test.sqlite3 already exists
db/development.sqlite3 already exists

then ‘rails s’ starts the server, we open up a new tab, and head to servername:3000:
Huzzah!

A bit over 4 hours. That’s a hell of a process to go through to get a thing running. I’m concerned that it might bork up magically in the next few months during an update (that’s what happened to my last one; ubuntu just *forgot* that ruby was installed somehow — it was fun), but at least it’s all under rvm now, and theoretically I can just remove and then reinstall a whole borked ruby environment. If things go too far astray, I can just delete all of rvm! This is the safest I’ve felt about these things in a while.
If something here worked very differently for you, or you’ve got comments, certainly let me know. I can’t promise I’ll be able to fix some problem you’re running across, but I’d like to think I’d give it a try. Thanks for reading; good luck.

Leave a Reply

Your email address will not be published.