1、下载Oracle客户端
下载地址:http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
需要下载的包(OSX 10.7 Lion)
instantclient-basic-macos.x64-11.2.0.3.0.zip
instantclient-sqlplus-macos.x64-11.2.0.3.0.zip
instantclient-sdk-macos.x64-11.2.0.3.0.zip
2、安装客户端
mkdir -p /opt/oracle
cd /opt/oracle
mv ~/Downloads/instantclient*.zip .
unzip instantclient-basic-macosx-11.2.0.3.0.zip
unzip instantclient-sdk-macosx-11.2.0.3.0.zip
unzip instantclient-sqlplus-macosx-11.2.0.3.0.zip
mv instantclient_11_2 instantclient
3、环境变量
cd instantclient
ln -s libclntsh.dylib.11.1 libclntsh.dylib
ln -s libocci.dylib.11.1 libocci.dylib
export NLS_LANG="AMERICAN_AMERICA.UTF8"
export ORACLE_HOME=/opt/oracle/instantclient
export RC_ARCHS=x86_64
export DYLD_LIBRARY_PATH=$ORACLE_HOME
ln -s /opt/oracle/instantclient/sqlplus /usr/local/bin/sqlplus
4、gem 安装
gem install activerecord-oracle-adapter
gem install ruby-oci8
5、安装 ruby-oci8
下载地址 http://rubyforge.org/frs/?group_id=256
cd ~/Downloads
tar xvzf ruby-oci8-1.0.6.tar.gz
cd ruby-oci8-1.0.6
ruby setup.rb config -- --with-instant-client=/opt/oracle/instantclient
make
sudo make install
6、安装测试:
irb(main):001:0> require 'oci8'
=> true
irb(main):002:0> gem 'activerecord-oracle_enhanced-adapter'
=> true