As with everything on this website. This is a note for myself in the future to see what (stupid thing) I did, and may not be useful to anyone else. But you may find what worked for me and what didn’t. But it won’t probably make sense to you..
Starting with Apple’s developer site:
And to do any serious Rails development you’ll want to install a production-quality web server, database server, and a few other goodies. Thankfully, a golden-path installation guide is already available.
It links to Tiger version of HIVELOGIC’s bog. I found snow leopard one: INSTALLING RUBY, RUBYGEMS, AND RAILS ON SNOW LEOPARD post Looks good. But I wanted to use some kind of package management script to make things easy — I know I am lazy –, so my friend recommended Video Tutorial. Very nice. First video cast is free. Following its instruction.
Download git (downloading source file)
tar -zxf git-1.7.6.tar.bz2 (to test to see if it works)
cd git-1.7.6
make
sudo make install
git --version
-bash: git: command not found
Well, that was quick. Got an error already. I didn’t pass the first thing. Orz… Didn’t even get to the next part, which looked kind of complicated like this below here:
cp contrib/completion/git-completion.bash ~
lines, copied from here:
# Git tab completion
source ~/git-completion.bash
# Show branch in status line
PS1=’[\W$(__git_ps1 " (%s)")]\$ ‘
export PROMPT_COMMAND=’echo -ne “\033]0;${PWD/#$HOME/~}\007″‘
Then I found this beginner’s guide blog post by Ryan Bigg. Written in June 2011, Nice. Thank you Ryan (and Google). Love kind people posting tutorials on the web.
I am a sucker and I couldn’t find snow leopard CD. So I purchased XCode from Apple App store for $5.
And here we go.
ruby -e "$(curl -fsSL https://gist.github.com/raw/323731/install_homebrew.rb)"
So far so good.
brew install git (Whoa, it works)
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm) I see “Notes for Darwin ( Mac OS X )” Good sign.
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bash_profile
. ~/.bash_profile
rvm notes
rvm install 1.9.2
Oh, oh. I am seeing some “Permission denied” here. Mmmm. Well. I am try keeping going.
ruby -v returned:
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.8.0]
Nice. I now know my machine is x86_64. I should know this stuff, but when I went to Git site, and try to download Mac installer, I didn’t know if I should be looking at x86_64 or i386.
Oh, boy. When I ran:
rvm --default use 1.9.2
I got tons of “Permission denied” errors. Mmmm.
Some people are getting similar errors it seems.
I don’t know what to do, but I am going forward.
gem install rails
I get couple of file 'lib' not found errors. But I also got
...
Successfully installed rails-3.0.9
24 gems installed
So, I am thinking it is a good thing.
brew install mysql
It looked like it froze, but it just took a long time.
It also came with lots of caveats:
==> Caveats
Set up databases to run AS YOUR USER ACCOUNT with:
unset TMPDIR
mysql_install_db –verbose –user=`whoami` –basedir=”$(brew –prefix mysql)” –datadir=/usr/local/var/mysql –tmpdir=/tmpTo set up base tables in another folder, or use a differnet user to run
mysqld, view the help for mysqld_install_db:
mysql_install_db –helpand view the MySQL documentation:
* http://dev.mysql.com/doc/refman/5.5/en/mysql-install-db.html
* http://dev.mysql.com/doc/refman/5.5/en/default-privileges.htmlTo run as, for instance, user “mysql”, you may need to `sudo`:
sudo mysql_install_db …options…Start mysqld manually with:
mysql.server startNote: if this fails, you probably forgot to run the first two steps up above
A “/etc/my.cnf” from another install may interfere with a Homebrew-built
server starting up correctly.To connect:
mysql -urootTo launch on startup:
* if this is your first install:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/mysql/5.5.14/com.mysql.mysqld.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plist* if this is an upgrade and you already have the com.mysql.mysqld.plist loaded:
launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
cp /usr/local/Cellar/mysql/5.5.14/com.mysql.mysqld.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/com.mysql.mysqld.plistYou may also need to edit the plist to use the correct “UserName”.
Warning: m4 macros were installed to “share/aclocal”.
Homebrew does not append “/usr/local/share/aclocal”
to “/usr/share/aclocal/dirlist”. If an autoconf script you use
requires these m4 macros, you’ll need to add this path manually.
==> Summary
/usr/local/Cellar/mysql/5.5.14: 6274 files, 219M, built in 3.1 minutes
Well. It looks like it is done. Is it?
Now I am following official Getting Started page:
Then
$ rails new blog
$ cd blog
$ bundle install
$ rake db:reset
$ rake db:migrate
$ rake db:populate
$ rails server
…should work in theory? I am too sleepy tonight.
Useful commands:
To check what version of ruby you have installed, do:
ruby -v
To see what your environment:
gem environment
See list of gems installed, and their versions
gem list
to install certain gem (Bundle install should get every gem listed in Gemlist)
gem install [gem name here]
gem rmagick require image magick installed on your machine, you can get them using Homebrew.
brew install imagemagick
