Installare Ruby on Rails su Mac Osx Snow Leopard

Scritto da Silvio Relli circa 2 anni fa. Jun3

Guida installazione rails leopard

Questa breve guida descrive come effettuare un'ottima installazione di Ruby a 64bit e tutto ciò che è necessario per iniziare a sviluppare con Ruby on Rails su Mac OSX.

Vedremo anche come installare MacPorts e MySQL dai sorgenti.

1) Installare Xcode 3.

L'installazione di Xcode si rende necessaria non tanto per l'editor stesso, quanto per l'insieme di librerie e tool che compongono l'SDK, come il compilatore gcc.

Potete trovare Xcode nel dvd di Snow Leopard oppure scaricare una versione aggiornata da qui: http://developer.apple.com/technologies/xcode.html (circa 2,3GB).

2) Installare Macports.

Macports è un tool che serve a scaricare, compilare e installare software opensource su Mac OSX.

Conosciuto fino a qualche anno fa come Darwin Ports, agisce in maniera simile ad Apt per Debian/Ubuntu o Yum per Redhat/Fedora risolvendo e scaricando le dipendenze del programma desiderato.

Scaricate l'immagine .dmg ed installate il .pkg in essa contenuto: http://www.macports.org/install.php

3) Settare le variabili d'ambiente.

Con il vostro editor preferito (Textmate regna!) dovrete aggiungere dei percorsi alla variabile PATH, la quale definisce le directory in cui il sistema cerca i programmi eseguibili da linea di comando.

Aprite dunque il terminale (Applicazioni/Utilità) e digitate:

mate ~/.profile 

La tilde ~ sulla tastiera italiana si ottiene premendo alt+5 ed identifica la vostra Home.

Se l'installazione di MacPorts è andata a buon fine noterete che il suo installer ha già provveduto ad aggiungere questa riga:

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

In fondo al file aggiungete questa riga:

export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"

Queste sono le directory dove finiranno i binari compilati di Ruby e MySQL.

Salvate il file e sempre da terminale eseguite

source ~/.profile

in modo da applicare le modifiche effettuate.

4) Qualche pacchetto necessario

Installiamo adesso qualche pacchetto da Port che si renderà utile in futuro: da terminale eseguite:

sudo port install curl git-core subversion bzip2

NON installate MySQL tramite Port, scaricheremo e compileremo il sorgente successivamente, in quanto l'installazione tramite Port a volte causa delle incompatibilità.

5) Download, compilazione e installazione di Ruby 1.8.7

mkdir ~/temp

cd ~/temp

curl -O ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p174.tar.gz

tar xzvf ruby-1.8.7-p174.tar.gz

cd ruby-1.8.7-p174

./configure --enable-shared --enable-pthread CFLAGS=-D_XOPEN_SOURCE=1

make

sudo make install

cd ..

6) Download, compilazione e installazione di Rubygems

curl -O http://files.rubyforge.vm.bytemark.co.uk/rubygems/rubygems-1.3.7.tgz

tar xzvf rubygems-1.3.7.tgz

cd rubygems-1.3.7

sudo /usr/local/bin/ruby setup.rb

cd ..

7) Installazione di Rails e Mongrel

Adesso che Rubygems è installato potete iniziare a usare il sistema di pacchettizazione gem per installare Rails e le altre gemme necessarie:

sudo gem install rails mongrel

Attendete prima di installare la gemma di MySQL, in quanto lo installeremo compilandolo dai sorgenti nel passo successivo.

8) Download, compilazione e installazione di MySQL

curl -O http://mysql.he.net/Downloads/MySQL-5.1/mysql-5.1.46.tar.gz

tar xzvf mysql-5.1.46.tar.gz

cd mysql-5.1.46

./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --enable-shared --with-plugins=innobase

make

sudo make install

cd /usr/local/mysql

sudo ./bin/mysql_install_db --user=mysql

sudo chown -R mysql ./var

cd ..

L'utente root di mysql per il momento è privo di password, opzionalmente potete settarla eseguendo:

mysqladmin -u root password 'miapassword'

Configuriamo launchctl in modo da avviare MySQL all'avvio del sistema:

curl -O http://hivelogic.com/downloads/com.mysql.mysqld.plist

sudo mv ./com.mysql.mysqld.plist /Library/LaunchDaemons

sudo chown root /Library/LaunchDaemons/com.mysql.mysqld.plist

sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysqld.plist

Installate infine la gemma MySQL di Ruby:

sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql

Come client grafico per MySQL vi consiglio il validissimo Sequel PRO, un tempo conosciuto come Cocoa MySQL: http://www.sequelpro.com/

Comments

  1. linsanguo88 dice 27/10/2011 at 09h43 later:

    A versatile and ultra striking pair of Ray Ban Uk sunglasses for women, the Ray Ban Wayfarer are highly reminiscent of a cat-eye style but with a more subtle shape, allowing you to channel the iconic look but in a more understated fashion. The sunglasses feature a thick acetate frame that becomes thicker at the outer vertical edges and draws to a point at the upper outer corners creating a suggestion of the cat-eye flick. The arms become narrower towards the ear stems and display the signature Ray-Ban logo in raised metal lettering positioned adjacent to the hinge. The overall aesthetic detailing remains minimal accentuating the versatility of the sunglasses. The Ray Ban Aviators are available in neutral and flattering colours including a shiny havana and tortoiseshell patterned frame with crystal green lenses and a shiny black frame with crystal green lenses. Some styles are also available with polarised lenses for the ultimate in visual quality and protection.

    This comment has been flagged for moderator approval. It won't appear on this blog until the author approves it.
  2. sdf dice 19/03/2012 at 14h35 later:

    http://www.cheapghdukoutlet.co.uk/

    This comment has been flagged for moderator approval. It won't appear on this blog until the author approves it.

Aggiungi sito/email

reCaptcha

   Anteprima commento