lost password?

home
•  reviewramp
•  rails +
•  javascript
•  webdev
•  django
•  xaraya
•  xamp +
•  musings

rss
Tag this page
   

ยป Blogs that link here
last modified: Feb 19, 2007
(first posted: Jan 31, 2007)
(4995 Reads)
keywords: apache install mysql php port
Permalink

Installing Rails on my iMac

Yet another log of one man's blind trek through unfamiliar territory: MacPorts, Apache 2, Ruby, Rails, MySQL5, and even PhP5. Includes a little demo to test the install.

Locomotive?

The first time through I used the no-brainer Locomotive package. I dont mean to say its not great, it really is so simple. Just download and install it. Everything is self contained - including the http server. It got me going enough to run a few tutorials.

Then, as recommended in the Agile book, I decided I should do a more manual install of the separate components. That way I can update individual things as needed, including gems (ruby components).

(Note the Agile book claims Locomotive uses SQLite, but i already had mySQL5 installed and it seemed to find it just fine as long as you edit the config/database.yml as needed).

Goin' For It

It all starts here with James Duncan Davidson's article, http://blog.duncandavidson.com/2006/04/sandboxing_rail.html

It's important to note that I already have Apache 1.33 running, with php5 and mysql5. Apache is what came in the box. Php and Mysql I upgraded manually (not with macports). I'm converting to MacPorts so I can upgrade easier in the future using one mechanism.

MacPorts

The first step is to get the MacPorts package manager, which lets you install (make) and update programs with commands like

sudo port install <portname>
port search <portname> 
port update <portname>

http://trac.macosforge.org/projects/macports

To start they call for Xcode and X11. Fortunately I'd already had those installed (had X11 for Gimp, which I dont use much, it sucks, but that's another story). Pretty sure you dont need X11 for Rails anyway :)

What I did need to do is setup my .profile (and remove the .bash_profile, copied any commands from there into .profile).

export PATH=/opt/local/bin:/opt/local/sbin:/opt/local/apache2/bin:$PATH
export DISPLAY=:0.0

and verify with "env" command. Then just download the .dmg package and run the installer.

Then,

$ sudo port selfupdate 

 

Get All The Stuff, per Our Friend James

$ sudo port install apache2
$ sudo port install mysql5 +server
$ sudo port install subversion +tools
$ sudo port install ruby
$ sudo port install rb-rubygems
$ sudo port install rb-termios
$ sudo port install rb-mysql
$ sudo gem install -y rake
$ sudo gem install -y rails
$ sudo gem install -y capistrano
$ sudo gem install -y mongrel
$ sudo gem install -y mongrel_cluster

OK, that went pretty smoothly. Thanks Jimmy. So far so good. Now what?

 

Installing Rails on my iMac

Posted by: Koos Brandt on September 24, 2007 08:45 AM
The issue with the symbolic link for tmp/mysql.sock

The way I understand this is that the mysql.sock gets created when mysql starts up. The link gets lost because the file gets deleted somehow, and therefore also the link.

I found a possible solution that seems to work.

In the launchdeamons there is a wrapper file for mysql.

I included the mysql.sock symbolic link in that file in the start section. On reboot it seems the link works.

Here is the code from the wrapper:

#!/bin/sh
#
# MacPorts generated daemondo support script
#

#
# Init
#
prefix=/opt/local

#
# Start
#
Start()
{
	/opt/local/share/mysql5/mysql/mysql.server start
	sudo ln -s /opt/local/var/run/mysql5/mysqld.sock /tmp/mysql.sock
}

#
# Stop
#
Stop()
{
	/opt/local/share/mysql5/mysql/mysql.server stop
}

#
# Restart
#
Restart()
{
	Stop
	Start
}

#
# Run
#
Run()
{
case $1 in
  start  ) Start   ;;
  stop   ) Stop    ;;
  restart) Restart ;;
  *      ) echo "$0: unknown argument: $1";;
esac
}

#
# Run a phase based on the selector
#
Run $1

#

Post a new comment

How many days in a week?

Name :