[省略废话,直接进入主题]
tar zxvf xxx.tar.gz cd xxx ./configure make sudo make install
gcc
安装XCODE支持,可以在系统光盘上找到( http://developer.apple.com/ )
第一步:卸载旧版
cd /usr/bin
sudo rm ruby rails irb rdoc ri gem
sudo rm /usr/lib/ruby
当然也可以选择将即将生成的 ruby 路径放入PATH的最前面,这样是否删除旧版都没关系。
PS. 请勿删除系统自带的RUBY,^_^,TEXTMATE许多bundles都会调用写死了环境的系统RUBY来执行操作的。
cat > ~/ .profile << EOF export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH" EOF . ~/.profile
重启下bash 查看 $PATH 是否正确。
第二步:安装Ruby
mkdir -p ~/Downloads/src cd ~/Downloads/src curl -O ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.gz tar xzvf ruby-1.8.7-p72.tar.gz cd ruby-1.8.7-p72 ./configure --enable-shared --enable-pthread CFLAGS=-D_XOPEN_SOURCE=1 make sudo make install
使用 which ruby 或 ruby -v 查看是否安装正确。新安装的ruby 路径应该是 /usr/local/bin/ruby
第三步:安装RubyGem 和 各种 gems
mkdir -p ~/Downloads/src cd ~/Downloads/src curl -O http://rubyforge.iasi.roedu.net/files/rubygems/rubygems-1.3.1.tgz tar xzvf rubygems-1.3.1.tgz cd rubygems-1.3.1 sudo ruby setup.rb
安装常用gems:
sudo gem install RedCloth rails mongrel
第四步:安装mysql
使用如下sh即可:
#!/bin/sh echo "=> Installing MySQL" echo "=> Creating the source folder" mkdir -p ~/Downloads/src cd ~/Downloads/src echo "=> Downloading" curl -O http://mysql.he.net/Downloads/MySQL-5.1/mysql-5.1.30.tar.gz echo "=> Extracting" tar xzvf mysql-5.1.30.tar.gz cd mysql-5.1.30 echo "=> Configuring" CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc \ CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors \ -fno-exceptions -fno-rtti" \ ./configure --prefix=/usr/local/mysql \ --with-extra-charsets=complex --enable-thread-safe-client \ --enable-local-infile --disable-shared echo "=> Compiling" make echo "=> Installing" sudo make install echo "=> Creating default databases" cd /usr/local/mysql sudo ./bin/mysql_install_db --user=mysql echo "=> Setting permissions" sudo chown -R mysql ./var echo "=> Creating launchd item" cat > /tmp/com.mysql.mysqld.plist << EOF <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>KeepAlive</key> <true/> <key>Label</key> <string>com.mysql.mysqld</string> <key>Program</key> <string>/usr/local/mysql/bin/mysqld_safe</string> <key>RunAtLoad</key> <true/> <key>UserName</key> <string>mysql</string> <key>WorkingDirectory</key> <string>/usr/local/mysql</string> </dict> </plist> EOF sudo mv /tmp/com.mysql.mysqld.plist /Library/LaunchDaemons sudo chown root /Library/LaunchDaemons/com.mysql.mysqld.plist echo "=> Starting MySQL" sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysqld.plist echo "=> Building the C Bindings for Ruby" sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config echo "=> Done"
Subversion
http://subversion.tigris.org/
这里尝试了新的方法,即用MAC 下的 apt-get "Fink" 完成自动安装。
Fink 官网 http://www.finkproject.org/index.php?phpLang=en
Git
http://git-scm.com/
目前版本:http://kernel.org/pub/software/scm/git/git-1.6.1.tar.gz
图形库
很方便的一个脚本,直接运行,等待下即可。
http://rubyforge.org/frs/?group_id=12&release_id=14565
编辑工具:TEXTMATE
1.5.7 破解版: macx.cn
其中railsbundle 过期了。下个2.0 的。
rails bundle: http://railsbundle.com/
参考资料:
Installing Ruby, Rubygems, Rails, and Mongrel on Mac OS X 10.5 (Leopard) link
Installing MySQL on Mac OS X link