Installing Rails on Tiger
Watch Tiger Get "Railed"
27 May 2005 Justin Williams Skip to comments
87 Comments
(
Closed)
One of the big principles of the Internet is the buzz factor. The buzz factor is determined by how much a group of people are talking about a given technology. In the early to mid-90s, the Internet itself was high on the buzz factor (it still is in some regards), in the late 90s Napster and its clones were the owners of the buzz. Today, there is a major buzz around a new web development framework called Rails. Developers seem to be flocking to the framework because of its impressive feature set, ease of use and 'coolness' factor. ### What is Rails ### Rails was created by David Heinemeier Hansson of 37Signals. David's Next Angle development firm was hired by 37Signals to create a project management solution known today as Basecamp. Initially, Basecamp started in PHP, but development shifted because of a desire for something simpler. Rails is built on top of the object-oriented Ruby programming language. Ruby was created in 1993 by Yukihiro Matsumoto. The Rails framework itself is built in three separate sub frameworks: Active Record, Action View and Action Controller (Action Mailer is its own separate entity). Each of these help Rails follow a Model-View-Controller paradigm (think Cocoa development).Ruby on Rails is one of the most hyped new technologies for web applications. Justin Williams shows you how to set up your Macintosh running Tiger to be a Rails development environment.
As Rails progressed, Hansson decided to release the framework for public consumption towards the end of last year. With this release, other developers from around the world began to contribute code to make the framework even stronger than it already was. Recently, Rails gained built-in Ajax, pagination and validation. Rather than having to write code to take care of all of these functions, Rails gives a developer advanced functionality with minimal code.
Other than Basecamp, where have you seen rails applications in the real world? Ever used 43 Things or Backpack? They are both built using the Rails framework. If you have ever bought a snowboard from Snowdevil, their shopping cart is designed on Rails as well. Personally, I used Rails to create a new tech support and purchase request system for my office to replace our aging Filemaker 5 solution. As Rails matures, I am sure there will be even more real-world implementations.
### Setup ###
Setting up a local Rails development environment is simple in Mac OS X Tiger. Because of its Unix underpinnings, a lot of the core functionality is already built in. For example, Ruby, Apache web server and SQLite are preinstalled with every Mac. Even with this free functionality, there are a few things we are going to need to install: namely RubyGems and the Rails framework itself.
SQLite is the database that will hold the data used in our Rails applications. If you're running Mac OS X Tiger, you will already have this installed. SQLite is used by the Core Data framework, which is new for developers. SQLite creates files to house data, and works great in small test environments.
RubyGems is a packaging system for Ruby that makes it simple to deploy _gems_, or small applications. RubyGems is what we will use to install the Rails framework. There are several other Gems available for things such as Markdown and Textile formatting.
I am writing this tutorial using Mac OS X Tiger 10.4.0. If you have not yet upgraded, you may want to hold off on following this tutorial. You will also need to be somewhat familiar with modifying Apache's configurations via the command line. If you have never done that or are uncomfortable doing it, ask a computer nerd friend to do it for you.
With all that out of the way, let's start installing stuff.
### Installing Everything ###
First we are going to want to confirm that you are running the latest version of Ruby just to be on the safe side. To do this, open up Terminal and type in the following command:
ruby -v
If it returns 'ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]' then we are ready to move on to the next step. If for some reason, it does not, you can download a Ruby package for Mac OS X.
For the RubyGems installation, you are going to need to download the package from the RubyGems website. The latest version as of this writing is 0.8.10. Download the tgz file, extract it in the Finder, and return to the Terminal.
cd ~/Desktop/rubygems-0.8.10
sudo ruby setup.rb
A stream of lines will announce that portions of the software have installed. If, at the end, you get notification that RubyGems has been succesfully built, we can move on to the next phase of the process: Rails itself. Type the following command:
sudo gem install rails
You will be asked to install a lot of files and resolve several dependencies. Say yes to all of them. What this does is use the RubyGems package manager to install the Rails packages. This could take a few minutes because it will update the Gem indexes that contain all available Gems.
Unfortunately, there are a few problems with the Ruby installation on Mac OS X Tiger that need to be fixed. Because of this, it makes it impossible to install some Gems on the system. The fine folks at the RubyGems project put together a quick fix that basically replaces Tiger's rbconfig.rb file with a working one. To take advantage of it, just run the following commands:
sudo gem install fixrbconfig
sudo fixrbconfig
You'll be asked to confirm if you want to complete this. Just say yes, and we'll move on to the last part of the installation: SQLite. For that, you simply have to type in:
sudo gem install sqlite3
You will be given 11 different options to choose from. Just pick #1, and it will install without a hitch.
With everything installed, let's setup a sample Rails application to make sure everything is working!
### Get on board ###
Let's create our first Rails app. I am not going to create anything spectacular. Just a simple contact database. I will provide links to more in-depth Rails tutorials at the end of this. First in the terminal, we need to create a new Rails application. Where you create it is up to you. I create mine under a Development directory in my home directory.
rails ~/Development/AddressBook/
chmod 777 ~/Development/AddressBook/db/
This creates all the base files and folders for a Rails application and then sets the database directory to be writeable (since we are using SQLite). Let's take a few moments to analyze what goes in each of these folders:
app - home to all your model, view and controller code.
components - mini applications that can bundle controllers, models and views together
config - database configuration, routing configuration, etc.
db - database schema file
doc - documentation for your app
lib - application specific custom code that doesn't belong in controllers, models or helpers.
log - error and access logs for your rails app
public - CSS, Javascript, and other static files related to your app
script - generator scripts
test - unit and fixture tests for those that are doing test-driven development
vendor - external libraries that the application depends on.
With our base application created, we are going to want to create our database next. This is a simple database that has a user's name, address, city, state, zip code and email address. We will be doing this using the _sqlite3_ command in the Terminal. Let's get started:
cd ~/Development/AddressBook/db/
sqlite3 addressbook.db
In the database, you are going to want to create a single table. Paste this code into the Terminal window's command prompt:
create table contacts (
id integer primary key autoincrement,
name varchar(255),
address varchar(255),
city varchar(255),
state char(2),
zipcode varchar(10),
email varchar(255)
);
With success, we can quit SQLite3.
.quit
Next, let's configure Apache's virtual host settings. We are setting up virtual hosts because it makes it easy to have multiple Rails apps in development at the same time. Setup is a bit complex, so let's take it one step at a time. First, open your httpd.conf file in the text editor of your choice. I prefer TextMate, but you may use vi, BBEdit or any other editor on the market.
Scroll near the bottom of the file and insert the following lines of text:
NameVirtualHost *:80
Justin Williams is founder and chief author for MacZealots. He switched to the Mac almost five years ago hasn't looked back since. When not blogging or coding, you can find him watching copious amounts of TV. Justin can be reached at



Reader Comments (87)
DISCLAIMER: The views expressed below are those of their authors and not necessarily endorsed or supported by MacZealots.com. In all cases, the comments provided here are offered as a courtesy and will be moderated. Any content deemed off-topic or offensive will be removed without notice. Posting a comment here boils down to two things: 1.) Think before you type 2.) Respect the thoughts of others. See our commenting guidelines and/or privacy policy for more information.
#1) On May 27, 2005 11:17 AM
Very nice, Justin
Maybe one comment: in the beginning of the article you state that “SQLite is the database that will hold the data used in our Rails applications. If youre running Mac OS X Tiger, you will already have this installed”. A bit further you go on to explain how to install SQLite (“Just say yes, and well move on to the last part of the installation: SQLite”). I know that these are just the Ruby bindings, but the choice of words could be misleading to newcomers.
Thanks for the article,
luc
#2) On May 27, 2005 11:20 AM
good point. I’ll remedy it.
#3) On May 29, 2005 3:42 PM
Really nice article.
Unfortunatly, I had to give up on:
~/Development/AddressBook/script/generate model Contact
which resulted in:
/usr/local/lib/ruby/1.8/net/https.rb:121: warning: method redefined; discarding old edit_path
/usr/local/lib/ruby/1.8/net/https.rb:130: warning: redefine socket_type
/usr/local/lib/ruby/1.8/net/https.rb:157: warning: method redefined; discarding old on_connect
dbfile: db/addressbook.db’ (ArgumentError)’: parse error on line 1, col 28: ` adapter: sqlite3
from /usr/local/lib/ruby/1.8/yaml.rb:119:in `load’
from /Users/dave/projects/AddressBook/script/../config/environment.rb:46
from /Users/dave/projects/AddressBook/script/../config/environment.rb:46:in `open’
from /Users/dave/projects/AddressBook/script/../config/environment.rb:46
from /Users/dave/projects/AddressBook/script/generate:2:in `require’
from /Users/dave/projects/AddressBook/script/generate:2
Any idea what I shall do?
#4) On May 31, 2005 7:01 PM
Seemed like a nice article; but I couldn’t get past “Get on Board.”
When I tried
rails ~/Development/AddressBook/
the only response I got was:
tcsh: rails: Command not found.
Any idea what’s going on?
Thanks,
Victor
#5) On May 31, 2005 8:29 PM
When you set up the validation rules for app/models, I think you meant for the code snippet to be pasted into the file “contact.rb” NOT “model.rb” as indicated.
I was able to follow the entire tutorial, but I’m getting a “MissingSourceFile in Contact#new” — No such file to load — sqlite.
I’ll run through the tutorial again and see if anything changes.
Thanks for the article!
#6) On June 1, 2005 3:46 PM
Fixed.
#7) On June 2, 2005 4:47 AM
Great tutorial, and I have been keen to get into Rails for while now. I have had a problem with the tutorial though. After completing all the steps I go to http://contacts/ in my browser and only see:
Unknown action
No action responded to new
I suspect maybe something went wrong with the scaffold section… maybe if you made you edited files available for download there would be less room for readers mistakes?
Any ideas why I am getting this message?
Thanks.
#8) On June 2, 2005 5:47 AM
The /usr/local/… issue seems to be a pretty widespread troublemaker. Some time ago there was a post at inessential.com that gave yet another example of a file pathname conflict issue (concerining the installation of osxutils.sf.net). The solution was to change the installation paths to /usr…according to the Filesystem Hierarchy Standard (www.pathname.com/fhs/).
#9) On June 3, 2005 3:45 PM
Excellent tutorial!!
It is great to get this in place for building and prototyping webapps. Now to tackle Ruby, which brings back a lot of nice features I miss from Smalltalk.
Vince
#10) On June 4, 2005 6:41 AM
@Vince: also see the post & discussion at www.theocacao.com!
#11) On June 4, 2005 4:38 PM
When I try to install Rails with: sudo gem install Rails it downloads the rails-analyzer instead of Rails itself. I have reinstalled RubyGems but to no avail, I couldn’t find the possible cause of this anywhere. Anyone has an idea what could be wrong?
#12) On June 4, 2005 6:36 PM
Hi, I found that I had to do :
sudo gem install —version ‘0.12.1’ rails
to get gem to not install just rails-analyzer. Maybe this is because the version is less than 1.0?
#13) On June 5, 2005 3:07 AM
Daniel…. Thank you very much! I’ve been having the same problem. The rails-analyzer was always installed when typing in:
gem install rails
instead of rails. I do not think it is a problem with the 1.0 version. I installed it on my webhost using the same command. My webhost uses a BSD server.
BTW a shorter version of the command is:
gem i -v 0.12.1 rails
#14) On June 6, 2005 11:01 AM
It should be a lower-case R in the gem installation. I fixed the typo. You can now pass Go and collect your $200.
#15) On June 7, 2005 3:15 AM
Apparently SQLite3 added support for autoincrement with integer primary key as of v 3.1. Even though I have the latest version of Tiger, I only have v 3.0.8 of SQLite3. Anyone know how to upgrade it without breaking Mac OS X?
#16) On June 8, 2005 12:49 AM
Great primer on getting it running in Tiger. I decided to go through the test app, too, since I haven’t worked with rails for a few months. I’m not sure if my setup differs much from others, but I found I had errors until I chmodded the database file to make it writable to the web server.
#17) On June 8, 2005 1:12 PM
Yeah, you have to chmod 777 db/addressbook.db and it will work OK as described above.
Cheers for the work up Justin
#18) On June 12, 2005 7:13 PM
I have the same problem as victor with the unknown command. Is this a sql lite issue or something with rails? See code below. any ideas. thx
greg-stratfords-imac-g5:~ Stratford$ rails ~/Development/AddressBook/
-bash: rails: command not found
#19) On June 25, 2005 6:43 AM
I got stuck at “configure Apaches virtual host settings”, where it sais: “open your httpd.conf file in the text editor of your choice”. There’s no such file on my harddisk. Is this correct? If so, where should I create this new file?
Thanks, Richard
#20) On June 30, 2005 3:43 AM
This tutorial was simpler than the one that originally came out, but i seem to be stuck in several places, and am quite lost. I had got the earlier tutes to work.
First, i get routing errors. If i remove the action => “new” portion from config.rb, then i do get a screen to enter a contact. Else this error:
ActionController::RoutingError in Contact#new
Showing /usr/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_controller/templates/scaffolds/new.rhtml where line #4 raised: Generation failure: No route for url_options {:controller=>"contact", :action=>"create"}, defaults: {:controller=>"contact", :action=>"new"} Extracted source (around line #4): 1: New 2: 3: 4: 5: 6:2. So now i remove the action part from config, and goto my browser. i get a new contact link which i press. i get an entry screen with “?action=new” in the URL. I enter a contact and press Create.
The create certainly catches an invalid email, but valid data gives a statement invalid.
ActiveRecord::StatementInvalid in Contact#create
SQL logic error or missing database: INSERT INTO contacts ('city', 'name', 'zipcode', 'address', 'email', 'state') VALUES('new delhgi', 'sss', '110022', 'ddddd', 'sdds@xman,org', 'DELHI')So i copy the statement and put it into sqlite3 manually, it gets inserted. It is even shown on coming to the contact application again. However, when i try to enter a new contact, or edit the existing one, once again a StatementInvalid happens.
The previous tutorial never gave such problems. i ran that on panther. Have installed rails again today on tiger exactly as specified above.
Any suggestions would be very welcome.
rahul benegal
#21) On June 30, 2005 3:49 AM
Richard
Using the Terminal app , do a “locate httpd.conf”
On my PB this always gives:
/private/etc/httpd/httpd.conf
Since this is write-protected, i would usually do:
sudo vim /private/etc/httpd/httpd.conf
hth,
rahul
#22) On June 30, 2005 4:09 AM
Sorry to have been a bit hasty. Yes, chmodding the “.db” file got rid of the SQL related problems. I thought the earlier chmod would have worked.
However, the routing problem remains.
I hope this observation doesnt qualify as a rant (and this may not even be the right place): developing a basic working app is very easy. However, this is very skeletal. For example, one needs login capabilities, query capabilities, proper screens that can be presented to a user straight off. I had written a code generator in Java once that gave a working application. Based on field suffixes (or hints) it would generate radio buttons, or textareas, static code fields etc. Key fields were used to generate a search field on top.
I am wondering if anyone has written or is writing an app over Rails that looks into these issues. Those of you who have worked on the previous tutes that came out a few months ago will note that there was a lot of changes to be made to the code to make the screens presentable. Some of that was in a template, so i agree that propogates to all screens, but there were significant changes to specific screens to make them functional too. That kind of stuff needs to be made in many many screens in a large app (such as, if i can recall, radio buttons, yes/no choice fields, code fields).
regards, rahul benegal
#23) On July 1, 2005 2:39 PM
Rahul, thanks. Spotlight didn’t find the file, but locate did.
Apache restarted without error messages. But when I try to open http://contacts/ Safari displays:
The requested URL / was not found on this server.
Apache/1.3.33 Server at contacts Port 80
So I guess Apache is running, and ‘it’ knows that contacts is a local machine (otherwise Safari would have displayed “can’t find the server”).
I’m stuck again.
#24) On July 4, 2005 5:19 AM
There is yet another Ruby installation guide over at jamie.blogthing.com (whith some interesting links such as users.tpg.com.au/aarnold/ for Ruby On Rails.zip)!
#25) On July 7, 2005 7:20 PM
Did anyone find a solution for the problem that Timur (#3) mentioned? I tried the tutorial on my computer at home and had to stop at the same point when the script/generate failed to create the appropriate files (I got the same error message listed in #3). The next day I gave it a shot on my computer at work and it worked perfectly. So I would love to have it working at home so I could mess around with it in my free time.
thanks
#26) On July 8, 2005 8:18 AM
Hello
I’ve got the same Problems that Jeff mentioned in #5:
MissingSourceFile in Contact#new
No such file to load — sqlite3
Show framework trace
This error occured while loading the following files:
sqlite3
Then I tried to install the sqlite3-ruby gem again, which gives me the following error message:
Building native extensions. This could take a while…
ERROR: While executing gem … (RuntimeError)
ERROR: Failed to build gem native extension.
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0 for inspection.
ruby extconf.rb install —remote sqlite3-ruby\nchecking for sqlite3.h… yes
checking for sqlite3_open() in -lsqlite3… no
Results logged to /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/ext/sqlite3_api/gem_make.out
And in gem_make.out I found these three lines logged:
ruby extconf.rb install —remote sqlite3-ruby
checking for sqlite3.h… yes
checking for sqlite3_open() in -lsqlite3… no
Has anyone solved this kind of problem (Jeff have you solved it).
I’m looking forward to try out Ruby on Rails, so it would be great if someone could help me.
Thanks
#27) On July 22, 2005 3:44 PM
I think the problem with the ActionController::RoutingError in Contact#new has to do with naming issues. I think you need to stay away from contact vs. contacts don’t you? something about what was singular in one becomes plural in the other?
I am just a newbie, but a good job all around with the exception of that bug.
Mike Buckley
#28) On July 26, 2005 6:39 AM
If RoR is unwilling to run on your Mac, throw a look at a promising RoR alternative: www.nitrohq.com
#29) On July 26, 2005 8:56 AM
There may be a more general bug with Ruby on Mac OS X 10.4: cf. tech.rufy.com/entry/46
#30) On July 31, 2005 12:30 AM
Justin, thanks for putting this together. Several of us had permission problems with the addressbook.db file; I think you should mention this explicitly in the tutorial. It’s better to “chown www” the file than to “chmod 777” it, by the way. Also, this is only a problem when we call rails from apache. Finally, here’s a URL to verify the application is alive for read-only databases: http://contacts/contact/list.
#31) On August 4, 2005 9:34 AM
When I try to install sqlite3, I get this:
[09:37 AM] /Downloads/2005-08-04/rubygems-0.8.11 11 $ sudo gem install sqlite3
Attempting local installation of ‘sqlite3’
Local gem file not found: sqlite3*.gem
Attempting remote installation of ‘sqlite3’
ERROR: While executing gem … (Gem::GemNotFoundException)
Could not find sqlite3 (> 0) in the repository
Why is this happening?
#32) On August 9, 2005 9:12 AM
If you are using rubygems-0.8.11 and it can’t find sqlite3, use “sqlite3-ruby” instead, i.e.
sudo gem install sqlite3-ruby
That should do it.
#33) On August 12, 2005 9:34 AM
Just what I needed - thanks a bunch!
#34) On August 25, 2005 10:16 AM
all worked well for after reading all the commnets.
#35) On September 2, 2005 10:37 AM
I was getting the same error as Lola. When I used MrChucho’s solutions, I got the following message:
Building native extensions. This could take a while…
can’t find header files for ruby.
ERROR: While executing gem … (RuntimeError)
ERROR: Failed to build gem native extension.
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0 for inspection.
ruby extconf.rb install sqlite3-ruby\n
Results logged to /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/ext/sqlite3_api/gem_make.out
Any ideas?
#36) On September 2, 2005 11:23 AM
Uh-oh!
Nevermind. I didn’t run “sudo fixrbconfig”
Everything works now.
#37) On September 16, 2005 2:51 PM
Hi, I ran into the problem Robbie faced while running sqlite3-ruby, but the problem persists even after I run the “sudo fixrbconfig” command.
Can anyone help me? thanks
#38) On September 16, 2005 2:53 PM
O, and my message varies slightly.
Here it is:
Building native extensions. This could take a while…
ERROR: While executing gem … (RuntimeError)
ERROR: Failed to build gem native extension.
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0 for inspection.
ruby extconf.rb install sqlite3-ruby\nchecking for sqlite3.h… yes
checking for sqlite3_open() in -lsqlite3… no
Results logged to /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/ext/sqlite3_api/gem_make.out
#39) On September 24, 2005 1:17 AM
I get as far as typing http://contacts/ into my browser. I get an actual website, not my localhost. Though, if I go to http://localhost, things are a-okay. Any ideas?
#40) On September 28, 2005 3:52 PM
After changing localhost copy in net info and the going and opening apache, http://contacts wont open?
Also after loading contacts values and then quiting, .quit dosen’t work, can’t get out of sqlite3?
Do we use the same commans as mysql? need help, I’m a newbee.
#41) On October 13, 2005 8:03 PM
I seem to be getting a similar problem to Redwolf’s. Everything goes great until I get to http://contacts/ When I get there I get the Apache confirmation page… If i go to http://localhost, I get the same Apache confirmation page. Any idea what the problem could be? Thanks.
#42) On October 16, 2005 10:26 PM
i’m at the same place as Redwolf and Thomas. http://contacts gets me to apache confirmation page. Any help would be appreciated.
#43) On October 25, 2005 11:10 AM
I ran the tutorial fine, but I am having a problem with adding another application under a new netinfo machine and new virtual host. I added to httpd.conf:
NameVirtualHost *:80
Include /private/etc/httpd/rails/*.conf
Then I created the /private/etc/httpd/rails directory with contacts.conf with the configuration from the tutorial. It worked fine. However when I added a new machine into netinfo and a file called projectx.conf to /private/etc/httpd/rails, http://projectx takes me to the contacts application. Here are the contents of projectx.conf:
ServerName projectx
ServerAlias projectx
DocumentRoot /Users/matthewdickinson/Rails/projectx/public
Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
Order allow,deny
I added ServerAlias because I thought that would fix it, but I was wrong. How did you set up your multiple applications? What is wrong with the method I came up with?
#44) On October 25, 2005 11:14 AM
I ran the tutorial fine, but I am having a problem with adding another application under a new netinfo machine and new virtual host. I added to httpd.conf:
NameVirtualHost *:80
Include /private/etc/httpd/rails/*.conf
Then I created the /private/etc/httpd/rails directory with contacts.conf with the configuration from the tutorial. It worked fine. However when I added a new machine into netinfo and a file called projectx.conf to /private/etc/httpd/rails, http://projectx takes me to the contacts application. Here are the contents of projectx.conf:
<VirtualHost projectx>
ServerName projectx
ServerAlias projectx
DocumentRoot /Users/matthewdickinson/Rails/projectx/public
<Directory /Users/matthewdickinson/Rails/projectx/public/>
Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
Order allow,deny
</Directory>
</VirtualHost>
I added ServerAlias because I thought that would fix it, but I was wrong. How did you set up your multiple applications? What is wrong with the method I came up with?
#45) On October 25, 2005 9:36 PM
<VirtualHost contacts> should be changed to <VirtualHost *>
#46) On October 27, 2005 2:29 PM
Thankyou for your article - it bailed me out of a tortuous time trying to get postgresql working with Rails, I decided to press on learning rails with SQLite instead while I fix postgresql another time.
Ran into some problems which I have got round eventually - your article doesn’t mention that you need to have SWIG installed before sqlite3-ruby
There are details at http://wiki.rubyonrails.com/rails/pages/HowtoUseSQLite but they assume you use fink/darwinports, but if you install from source you MUST add /usr/local/bin/ to your $PATH otherwise it still doesn’t work.
#47) On October 29, 2005 2:00 AM
I’m getting the same problem as posts #39, #41, #42. Can anybody address this issue? When I type in http://contacts/ - it actually pulls up a website rather than localhost. If I type http://localhost/ I get the apache default page, if I type in http://localhost:80/ - I get congrats for putting on ruby on rails….? Any idears?
#48) On October 31, 2005 8:00 PM
Thank you so much for this efficient and usefull article !
#49) On November 7, 2005 8:37 AM
For those of you that can’t get apache to use the virtualhost try using the local host ip: 127.0.0.1 instead of the wildcard *. This fixed it for me…
[code]
NameVirtualHost 127.0.0.1:80
ServerName foo.dev
DocumentRoot /Users/tijs/Code/Addressbook/public
[/code]
#50) On November 7, 2005 10:56 AM
APACHE CONFIGURATION
NameVirtualHost *:80
<VirtualHost *:80>
ServerName contacts
DocumentRoot /Rails/AddressBook/public
<Directory /Rails/AddressBook/public>
Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
Order allow,deny
</Directory>
</VirtualHost>
IMPORTANT NOTES:
If you copy the above configuration to the end of /etc/httpd.conf and change the path /Rails/AddressBook/public to whatever your application path is, then it should work fine. You also need to create the machine contacts in NetInfo manager as the instructions in the article show.
Whatever you put after NameVirtualHost needs to be the same as what you put in the <VirtualHost> directive.
Whatever you put after ServerName needs to be the same as what you put into NetInfo Manager as a new machine.
When name based virtual hosting is enabled, the main server configuration is no longer used. You should create a virtual host directive with the same information as the main server configuration, and it should be the first virutal host directive.
If you point a name at your machine and there is not a ServerName which matches it, then the first virtual host directive in order from top to bottom of the httpd.conf file will be used. Know that localhost will now point to your first virtual host directive unless you specifically create one with ServerName localhost.
#51) On November 8, 2005 11:15 AM
In the course of following this I solved several problems, thanks ! Gem etc.
For a first try-it-out Rails tutorial I find it a touch invasive to have to add a virtual host. I just want to try stuff out, not get involved.
I also got the “routing error”. This is because I had not deleted/renamed the public/index.html file
You should state this necessity right at the point you discuss the routes.rb file
thanks!
#52) On November 8, 2005 6:05 PM
I pretty much followed all the leads but I’m still getting this error when running the app. As anyone been able to resolve this issue? Thank you in advance for all the help.
http://contacts/
MissingSourceFile in Contact#new
No such file to load — sqlite3
#53) On November 10, 2005 8:57 PM
When i goto http://contacts/ i get a directory listing of the public directory….did i miss a step? =\
#54) On November 13, 2005 3:50 PM
I run into issues with the tutorial at the stage where SQLite is installed; I’m on 10.4.3 with XCode 2.2 installed, and things appear to be slightly different. (The header file is not present, for instance.) I’ll poke around, but it would be good to know if others are having similar issues.
#55) On November 14, 2005 3:23 PM
I had the same problem as Paul Brown (Tiger w/ Xcode 2.2) and fixed it doing this:
1) open /usr/lib/ruby/gems/1.8/gems/fixrbconfig-1.2/bin/fixrbconfig
2) in that file, replace “/usr/lib/ruby/1.8/powerpc-darwin8.0” with “/sw/lib/ruby/1.8/powerpc-darwin” (I just Spotlighted for “ruby.h” and that’s where it appeared to be… maybe in other systems this is different, I don’t know…)
2.1) do not replace it in line 21 though!
3) re-run sudo fixrbconfig
4) continue with the installation…
Hope it helps!
#56) On November 15, 2005 1:59 AM
Actually, the suggestion from Adrian will only work if you have ruby 1.8 was installed via Fink. Taking a hint from Adrian, I ran a quick find, and it looks like XCode 2.2 has migrated things into a different naming scheme; specifically, the ruby.h file is now in /usr/lib/ruby/1.8/universal-darwin8.0.
#57) On November 15, 2005 2:34 AM
You’re right! Thanks for the information :)
#58) On November 16, 2005 1:04 AM
Hi, excellent tutorial! really easy to follow.
I have gotten to the app but when I submit a contact I get this error:
ActiveRecord::StatementInvalid in Contact#create
SQL logic error or missing database: INSERT INTO contacts (‘city’, ‘name’, ‘zipcode’, ‘address’, ‘email’, ‘state’) VALUES
RAILS_ROOT: /Users/raz/Development/AddressBook/public/../config/..
Application Trace | Framework Trace | Full Trace
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/connection_adapters/abstract_adapter.rb:67:in `log’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/connection_adapters/sqlite_adapter.rb:133:in `execute’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/connection_adapters/sqlite_adapter.rb:148:in `insert’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/base.rb:1446:in `create_without_callbacks’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/callbacks.rb:261:in `create_without_timestamps’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/timestamp.rb:30:in `create’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/base.rb:1431:in `create_or_update_without_callbacks’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/callbacks.rb:249:in `create_or_update’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/base.rb:1231:in `save_without_validation’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/validations.rb:687:in `save_without_transactions’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/transactions.rb:126:in `save’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/transactions.rb:126:in `transaction’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/transactions.rb:91:in `transaction’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/transactions.rb:118:in `transaction’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/transactions.rb:126:in `save’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/scaffolding.rb:122:in `create’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/base.rb:841:in `send’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/base.rb:841:in `perform_action_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/filters.rb:332:in `perform_action_without_benchmark’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/benchmarking.rb:69:in `measure’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/rescue.rb:82:in `perform_action’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/base.rb:365:in `send’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/base.rb:365:in `process_without_session_management_support’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/session_management.rb:116:in `process’
/usr/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/dispatcher.rb:38:in `dispatch’
/Users/raz/Development/AddressBook/public/dispatch.cgi:10
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/connection_adapters/abstract_adapter.rb:67:in `log’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/connection_adapters/sqlite_adapter.rb:133:in `execute’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/connection_adapters/sqlite_adapter.rb:148:in `insert’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/base.rb:1446:in `create_without_callbacks’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/callbacks.rb:261:in `create_without_timestamps’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/timestamp.rb:30:in `create’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/base.rb:1431:in `create_or_update_without_callbacks’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/callbacks.rb:249:in `create_or_update’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/base.rb:1231:in `save_without_validation’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/validations.rb:687:in `save_without_transactions’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/transactions.rb:126:in `save’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/transactions.rb:126:in `transaction’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/transactions.rb:91:in `transaction’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/transactions.rb:118:in `transaction’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/transactions.rb:126:in `save’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/scaffolding.rb:122:in `create’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/base.rb:841:in `send’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/base.rb:841:in `perform_action_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/filters.rb:332:in `perform_action_without_benchmark’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/benchmarking.rb:69:in `measure’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/rescue.rb:82:in `perform_action’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/base.rb:365:in `send’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/base.rb:365:in `process_without_session_management_support’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/session_management.rb:116:in `process’
/usr/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/dispatcher.rb:38:in `dispatch’
/Users/raz/Development/AddressBook/public/dispatch.cgi:10
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/connection_adapters/abstract_adapter.rb:67:in `log’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/connection_adapters/sqlite_adapter.rb:133:in `execute’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/connection_adapters/sqlite_adapter.rb:148:in `insert’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/base.rb:1446:in `create_without_callbacks’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/callbacks.rb:261:in `create_without_timestamps’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/timestamp.rb:30:in `create’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/base.rb:1431:in `create_or_update_without_callbacks’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/callbacks.rb:249:in `create_or_update’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/base.rb:1231:in `save_without_validation’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/validations.rb:687:in `save_without_transactions’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/transactions.rb:126:in `save’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/transactions.rb:126:in `transaction’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/transactions.rb:91:in `transaction’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/transactions.rb:118:in `transaction’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/transactions.rb:126:in `save’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/scaffolding.rb:122:in `create’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/base.rb:841:in `send’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/base.rb:841:in `perform_action_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/filters.rb:332:in `perform_action_without_benchmark’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/benchmarking.rb:69:in `measure’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/rescue.rb:82:in `perform_action’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/base.rb:365:in `send’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/base.rb:365:in `process_without_session_management_support’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/action_controller/session_management.rb:116:in `process’
/usr/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/dispatcher.rb:38:in `dispatch’
/Users/raz/Development/AddressBook/public/dispatch.cgi:10
Request
Parameters: {“commit”=>”Create”, “contact”=>{“name”=>”Roger”, “city”=>”hjkhkjlh”, “zipcode”=>”jhjkhkjh”, “address”=>”kjlj”, “state”=>”kljhjklh”, “email”=>”jkhkjhkjh@sdfdsa.com”}}
Show session dump
—-
flash: !ruby/hash:ActionController::Flash::FlashHash {}
Response
Headers: {“cookie”=>[], “Cache-Control”=>”no-cache”}
#59) On November 16, 2005 4:14 AM
I am running OSX 10.4.3 and Xcode 2.2. I initially had problems with fixrbconfig (the location of ruby.h) but changed the path per posts #55-57 and received a success message. I have had less luck installing gem sqlite3-ruby. Any suggestions? My fixrbconfig confirmation followed by gem install sqlite3-ruby error below. Thanks!
TM5:/usr/lib/ruby/gems/1.8/gems/fixrbconfig-1.2/bin brian$ sudo fixrbconfig
================
This program will replace your rbconfig.rb , located in /usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rb
Press enter continue or ctrl-c to abort.
Backing up original rbconfig.rb in /usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rb.bak
All Done! You should be able to compile C extensions now!
TM5:/usr/lib/ruby/gems/1.8/gems/fixrbconfig-1.2/bin brian$ sudo gem install sqlite3-rubyAttempting local installation of ‘sqlite3-ruby’
Local gem file not found: sqlite3-ruby*.gem
Attempting remote installation of ‘sqlite3-ruby’
Select which gem to install for your platform (powerpc-darwin8.0)
1. sqlite3-ruby 1.1.0 (ruby)
2. sqlite3-ruby 1.1.0 (mswin32)
3. sqlite3-ruby 1.0.1 (ruby)
4. sqlite3-ruby 1.0.1 (mswin32)
5. sqlite3-ruby 1.0.0 (mswin32)
6. sqlite3-ruby 1.0.0 (ruby)
7. sqlite3-ruby 0.9.0 (ruby)
8. sqlite3-ruby 0.9.0 (mswin32)
9. sqlite3-ruby 0.6.0 (ruby)
10. sqlite3-ruby 0.5.0 (ruby)
11. Cancel installation
> 1
Building native extensions. This could take a while…
can’t find header files for ruby.
ERROR: While executing gem … (RuntimeError)
ERROR: Failed to build gem native extension.
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0 for inspection.
ruby extconf.rb install sqlite3-ruby\n
Results logged to /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/ext/sqlite3_api/gem_make.out
TM5:/usr/lib/ruby/gems/1.8/gems/fixrbconfig-1.2/bin brian$
#60) On November 16, 2005 5:01 PM
^^^
I got impatient and did a cheap fix — uninstalled xcode 2.2 and installed the older version on the Tiger CD — and successfully gem installed sqlite3-ruby-1.1.0 (I think). On to the next steps in the tutorial…
#61) On November 17, 2005 3:43 AM
I am having the same problem as #59, but have a different error:
$ sudo gem install sqlite3
Attempting local installation of ‘sqlite3’
Local gem file not found: sqlite3*.gem
Attempting remote installation of ‘sqlite3’
ERROR: While executing gem … (Gem::GemNotFoundException)
Could not find sqlite3 (> 0) in the repository
Can anyone help?? I can’t do what Brian does since I can’t find the older version of xcode. Thanks
#62) On November 18, 2005 10:10 AM
sqlite3 error:
The gem’s name is actually ‘sqlite3-ruby’, not ‘sqlite3’.
Modify the command.
#63) On November 19, 2005 12:57 AM
HI Daddio: Thanks for the help, that gets it further along, but then I’m stuck here:
> Attempting local installation of ‘sqlite3-ruby’
> Local gem file not found: sqlite3-ruby*.gem
> Attempting remote installation of ‘sqlite3-ruby’
> Select which gem to install for your platform (powerpc-darwin8.0)
> 1. sqlite3-ruby 1.1.0 (ruby)
> 2. sqlite3-ruby 1.1.0 (mswin32)
> 3. sqlite3-ruby 1.0.1 (ruby)
> 4. sqlite3-ruby 1.0.1 (mswin32)
> 5. sqlite3-ruby 1.0.0 (mswin32)
> 6. sqlite3-ruby 1.0.0 (ruby)
> 7. sqlite3-ruby 0.9.0 (ruby)
> 8. sqlite3-ruby 0.9.0 (mswin32)
> 9. sqlite3-ruby 0.6.0 (ruby)
> 10. sqlite3-ruby 0.5.0 (ruby)
> 11. Cancel installation
> 1
> Building native extensions. This could take a while…
> can’t find header files for ruby.
> ERROR: While executing gem … (RuntimeError)
> ERROR: Failed to build gem native extension.
> Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0 for inspection.
> ruby extconf.rb install sqlite3-ruby\n
>
> Results logged to /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/ext/sqlite3_api/gem_make
Is this the same problem earlier in the post #56, where the ruby.h file is now in /usr/lib/ruby/1.8/universal-darwin8.0? If so, what files do I need to fix?
I apologize for asking stupid questions, but I really have no idea on how ruby and gems’s build processes work, and so am really flying blind
#64) On November 19, 2005 12:47 PM
powerpc-darwin8.0 vs universal-darwin8.0
Warning!
Follow these directions at your own risk.
Make sure that you are comfortable with what you are doing.
I would be glad to read any comments that anybody else has about this.
These got me through the install and down to the label: ‘Get on Board’
The problem that I finally figured out is that the directions in this setup/tutorial assume that ‘ruby.h’ and some other files are in the directory /usr/lib/ruby/1.8/powerpc-darwin8.0 when they are actually in
/usr/lib/ruby/1.8/universal-darwin8.0.
I followed a more convoluted set of steps, but the simpliest course should be to execute these commands in the terminal:
cd /usr/lib/ruby/1.8/universal-darwin8.0
sudo cp *.h ../powerpc-darwin8.0/
After this you should be able to continue the install with
sudo gem install fixrbconfig
sudo fixrbconfig
sudo gem install sqlite3-ruby
Let me know.
#65) On November 19, 2005 12:49 PM
The editor did not preserve one form-feed in my last post.
cd /usr/lib/ruby/1.8/universal-darwin8.0 sudo cp *.h ../powerpc-darwin8.0/
should be read as two commands at the terminal prompt:
cd /usr/lib/ruby/1.8/universal-darwin8.0
sudo cp *.h ../powerpc-darwin8.0/
#66) On November 19, 2005 12:57 PM
Those of you reporting the:
checking for sqlite3_open() in -lsqlite3� no
error while installing sqlite3-ruby, probably made the same mistake that I did. I downloaded the fixrbconfig gem but I never ran it. In other words, I forgot to do a:
sudo fixrbconfig
after downloading it. Duh.
#67) On November 22, 2005 8:22 PM
Hi,
Has anyone solved the configuration issues for Mac OS X Server 10.4? Modifying httpd.conf doesn’t seem to be the right method. I was successful at creating the virtual machine ‘contacts’ using NetInfo and getting to the
“Congratulations, you’ve put Ruby on Rails!” page by setting up a link to /Users/rich/dev/Addressbook/public/
But as soon as I delete the index.html file, I can’t seem load the AddressBook application.
In Server admin I found the option for ExecCGI but nothing about SymLinks or any of the following options:
AllowOverride all
Allow from all
Order allow,deny
If I point to routes.rb, all I get is the contents of the file.
Any help would be appreciated!
#68) On November 24, 2005 1:49 AM
Seeing the same error as #58. OS is 10.4.3 and Xcode 2.2. As for my #67 post, I moved to a Non-Server version and the tutorial works until I try to create a record…
#69) On November 24, 2005 10:45 AM
To fix the issue in #58 and my reported issue in #68 you need to set the privledges on addressbook.db file. For some reason the chmod 777 on the directory wasn’t inherited by the file that was created by the Sqlite command.
chmod 777 addressbook.db
#70) On November 25, 2005 10:53 PM
good stuff there Rich, that fixed it all!!!
#71) On November 30, 2005 7:25 PM
In response to #63 I was having the same problem, until I installed XCode (which is required for the rbconfig fix too) Just install XCode from your Tiger DVD and run
sudo gem install sqlite3-ruby
You should then be all set. Setting up MySQL was driving me nuts, I’m having a ton of problems, I can see it from terminal, create databases, tables, set permissions, but I can’t get this app to connect or phpMyAdmin via the usernames I created. Followed their directions exactly, but it still won’t work… Needless to say I’m happy to sqlite up and running for easier development…
#72) On December 1, 2005 1:14 PM
Followup to my last comment on setting up MySQL, I was using version 5.0 which does uses a new “improved” authentication method. All it took was the following to fix it.
shell>mysql -u root -p
mysql> SET PASSWORD FOR root@localhost = OLD_PASSWORD(‘mypassword’);
Voila, worked like a charm. phpMyAdmin and CocoaMySQL both connect, and I’m good to go.
#73) On December 4, 2005 1:18 AM
Installed everything, but still get the default Ruby on Rails Installation Successful page. Help?
_____
Congratulations, you’ve put Ruby on Rails!
Before you move on, verify that the following conditions have been met:
The log and public directories must be writable to the web server (chmod -R 775 log and chmod -R 775 public).
The shebang line in the public/dispatch* files must reference your Ruby installation.
You might need to change it to #!/usr/bin/env ruby or point directly at the installation.
Rails on Apache needs to have the cgi handler and mod_rewrite enabled.
Somewhere in your httpd.conf, you should have:
AddHandler cgi-script .cgi
LoadModule rewrite_module libexec/httpd/mod_rewrite.so
AddModule mod_rewrite.c
Take the following steps to get started:
Create empty development and test databases for your application.
Recommendation: Use *_development and *_test names, such as basecamp_development and basecamp_test
Warning: Don’t point your test database at your development database, it’ll destroy the latter on test runs!
Edit config/database.yml with your database settings.
Create controllers and models using the generator in script/generate
Help: Run the generator with no arguments for documentation
See all the tests run by running rake.
Develop your Rails application!
Setup Apache with FastCGI (and Ruby bindings), if you need better performance
Remove the dispatches you don’t use (so if you’re on FastCGI, delete/move dispatch.rb, dispatch.cgi and gateway.cgi)
Trying to setup a default page for Rails using Routes? You’ll have to delete this file (public/index.html) to get under way. Then define a new route in config/routes.rb of the form:
map.connect ”, :controller => ‘wiki/page’, :action => ‘show’, :title => ‘Welcome’
Having problems getting up and running? First try debugging it yourself by looking at the log files.
Then try the friendly Rails community on the web or on IRC (FreeNode#rubyonrails).
#74) On December 4, 2005 3:04 AM
Got it. Renamed index.html to indexOLD.html in public folder.
#75) On December 9, 2005 7:52 PM
On Tiger 10.4.2 with XCode 2.0, I also needed to run “sudo gem install sqlite3-ruby” rather than “sudo gem install sqlite3” - and chose option 2, as it matched the option suggested with “sudo gem install sqlite3.”
Had to chmod 777 addressbook.db file as well (I agree that chown www might be a better choice, but testing here), to rid myself of the dump that was otherwise baffling, and it didn’t quite hit me across the face from the tutorial text either that I had to initially remove the index.html file within this project folder, but it is Friday night after a long winter week.
Quite a bit of this is voodoo to me thus far, but with some further tutorials like this to move me along the curve, it does indeed look like there is much work done automagically for the budding programmer.
Thanks Justin!
#76) On January 7, 2006 11:36 AM
I’m running Tiger 10.4.3 with XCode 2.2 and I also experienced the problem with the missing Ruby headers. I solved the problem by running this in the Terminal:
cd /usr/lib/ruby/1.8/powerpc-darwin8.0/
sudo ln -s ../universal-darwin8.0/*.h ./
This is pretty much the same as the solution in comment #64, except things won’t break/get outdated if an update of XCode overwrites the Ruby headers.
#77) On January 7, 2006 5:56 PM
I am stuck at the stage that posts 39, 41. 42: I get the standard apache welcome page at http://contacts/. Here is my httpd.conf section (using a mix of suggestions from other posters, nothing helps):
NameVirtualHost *:80
ServerName contacts
DocumentRoot /Users/apple/Development/AddressBook/public
Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
Order allow,deny
OS X 10.4, XCode Tools 2.2, I’ve run the fix, successfully installed sqlite3-ruby: any ideas?
Kind of frustrating, but otherwise a well written tutorial…
d
#78) On January 7, 2006 5:58 PM
hmm, the problem of eviscerated code. Yes, I have the correct tags in the httpd.conf file. but sadly no preview, and that stuff disappeared. But the NameVirtualHost and VirtualHost stuff matches, etc.
#79) On January 7, 2006 6:05 PM
A couple more comments directed at the author:
the terminal screen snapshot and the code text above it shows
“sudo gem install sqlite3”
but as another poster has commented, this should now be ‘sqlite3-ruby’. Might be worth updating.
Also, the screen capture shows the ruby install of sqlite3 as option 1. As of this writing, it is option 2; the windows version is option 1.
Finally, for the above reason, you should probably update the text to not say “Just pick #1, and it will install without a hitch.” Change it to something more specific…
dan
#80) On January 13, 2006 6:55 PM
OK - I’ve managed to follow everything properly so far; I didn’t realise that I didn’t have the XCode tools installed until I tried the fixrbconfig… perhaps this should be clarified?
Other than that, and the couple of points mentioned by Dan above, I’ve got to the point where I need to “generate model Contact”… but unfortunately it would appear that the “generate” command is not present. Anyone know where this command comes from, and how I can get finished up?
Cheers!
(BTW - good tutorial Justin; easy to follow, and without it I don’t think I’d have ever even tried to have a play around with this…!)
#81) On January 23, 2006 7:04 PM
You need to change:
sudo gem install sqlite3
to:
sudo gem install sqlite3-ruby
#82) On January 24, 2006 10:19 PM
FIXES FOR PROBLEMS IN THIS TUTORIAL
1. INSTALLING SQLITE
If you are using rubygems-0.8.11 and it cant find sqlite3, use sqlite3-ruby instead, i.e.
sudo gem install sqlite3-ruby
That should do it.
2. HTTP SETTINGS
NameVirtualHost *:80
ServerName contacts
DocumentRoot /Users/***********THIS SHOULD BE YOUR DIR*********/Development/AddressBook/public
Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
Order allow,deny
3. ROUTING ISSUE
To fix the issue in #58 and my reported issue in #68 you need to set the privledges on addressbook.db file. For some reason the chmod 777 on the directory wasnt inherited by the file that was created by the Sqlite command.
chmod 777 addressbook.db
#83) On January 25, 2006 5:25 AM
I’m getting the same error as some have when I go to http://contacts/ I’m seeing the Mac OS X Server Welcome to your website page (running this on OS X Server 10.4.4). I’ve tried all the permutations of NameVirtualHost *:80 listed above… And doublechecked my paths.. I’ve tried :
NameVirtualHost *:80
ServerName contacts
DocumentRoot “/Users/tornado/builds/AddressBook/public”
Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
Order allow,deny
and
NameVirtualHost *:80
ServerName contacts
DocumentRoot “/Users/tornado/builds/AddressBook/public”
Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
Order allow,deny
Both gave me same thing… Any help?
#84) On February 2, 2006 2:42 AM
I have a few questions if someone can spare a minute or two.
I followed the tutorial and ran into the same issue with the sudo fixrbconfig spitting back the xcode for Tiger DVD request. I am running Tiger w/ X2.2 loaded and when I Spotlight for the ruby.h file it’s no where to be seen. What step(s) do you recommend take to get back on the right rail?
#85) On February 2, 2006 2:55 AM
Reinstalling XCode 2.2 was the key. ruby.h now available
#86) On February 7, 2006 4:44 PM
I think I’ve managed to answer my own query after some time spent bashing my head off Google…
I replace the section:
~/Development/AddressBook/script/ # generate model Contact
~/Development/AddressBook/script/ # generate controller contact
with:
~/Development/AddressBook/script/ # cd ..
~/Development/AddressBook/ # ruby script/generate model Contact
~/Development/AddressBook/ # ruby script/generate controller contact
This seemed to “do stuff” - although I’m not too sure why… my initial suspicion was something about paths, but that’s a guess…
It’s all well and good learning by doing, but sometimes I think I’d like to know why I need to do something… think I need to work through some other tutorials after this one ;-)
Also, can I point out that under the same section, the following set of instructions says to paste the code into contact.rb within app/model… yet the folder is actually app/models (and similarly app/controllers) - pretty elementary, but I couldn’t figure out why I couldn’t edit the right file until I switched to the right directory one step at a time…
#87) On February 15, 2006 6:55 PM
The CGI variant is very very slow, as pointed out already. FastCGI is installed on 10.4/Tiger (not sure about 10.3 etc). So I did the following:
1) Uncomment the following lines in httpd.conf:
#LoadModule fastcgi_module libexec/httpd/mod_fastcgi.so
#AddModule mod_fastcgi.c
2) Add the following lines right above your VirtualHost declaration:
FastCgiIpcDir /tmp/fcgi_ipc/
AddHandler fastcgi-script .fcgi
3) Go in your RAILS public folder and edit the .htaccess file to:
Comment the line:
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
Uncomment the line:
#RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
4) I deleted the dispatch.cgi (move it away, would be better instead!)
5) Check your /var/log/httpd/error_log, it should state similar lines like below:
FastCGI: process manager initialized (pid 2779)
FastCGI: (dynamic) server “/Users/tdegrunt/cookbook/public/dispatch.fcgi” started (pid 2785)