Skip to content

Instantly share code, notes, and snippets.

@mhorbul
Created July 8, 2009 19:18
Show Gist options
  • Save mhorbul/143108 to your computer and use it in GitHub Desktop.
Save mhorbul/143108 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Maksim Horbul
# - Setup Ruby/Rails environment on OSX Leopard
sudo su -
# setup MySQL Server
MYSQL_VERSION=5.1.36
cd /tmp
wget -O - http://opensource.become.com/mysql/Downloads/MySQL-5.1/mysql-$MYSQL_VERSION.tar.gz \
| tar oxz
cd mysql-$MYSQL_VERSION
./configure --prefix=/usr/local/mysql \
--with-unix-socket-path=/usr/local/mysql/run/mysql_socket \
--with-mysqld-user=mysql --with-comment --with-debug
make && make install
# complete setup and change permissions
/usr/local/mysql/bin/mysql_install_db --force
chgrp -R mysql /usr/local/mysql
chown -R mysql /usr/local/mysql/run /usr/local/mysql/var
# run the MySQL server
/usr/local/mysql/bin/mysqld_safe --user=mysql &
# install mysql gem
export MYSQL_HOME=/usr/local/mysql
sudo env ARCHFLAGS="-arch i386" gem install mysql -- \
--with-mysql-include=$MYSQL_HOME/include/mysql \
--with-mysql-lib=$MYSQL_HOME/lib/mysql
# exit root shell
exit
# modify bash profile so mysql executable is available in the PATH
cat >> ~/.profile <<\EOF
export MYSQL_HOME=/usr/local/mysql
export PATH=$MYSQL_HOME/bin:$PATH
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment