Heroku
If you're deploying stuff on Heroku, grab the toolbelt here.
Homebrew
Previously I was using MacPorts, but after hearing so many great things about Homebrew I took the plunge. Its simply a great package manager and you can download it here. For example, OS X doesn't ship with wget
, so to install it you can simply run the following on the command line:
brew install wget
Done. Moving on.
RVM
RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.
What it says on the tin. It allows you to easily install multiple versions of Ruby on your system. It also allows you create gem sets and swap between them. To install:
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
Then:
source ~/.rvm/scripts/rvm
Now we're ready to install Ruby! The only problem is that with Xcode 4 the provided compiler (gcc
) is LLVM based and not yet fully supported by Ruby and gems. Now before you go hunting for an older gcc
(which I did) its not necessary.
To install Ruby 1.9.2 (which is required for Heroku) enter:
rvm install 1.9.2 --with-gcc=clang
When that is done, lets check what version of Ruby we have set as the system default:
ruby --version
Mine said Ruby 1.8.7. Lets set 1.9.2 to be default:
rvm use 1.9.2 --default
If you run ruby --version
it should now say 1.9.2. If you ever want to go back to the system default simply enter rvm system
. So now we have an easy way of swapping Ruby versions and you can read more about it here.
Sublime Text
Sublime Text is my favourite editor of all time. Get it here. Read some great tips and tricks here.
MySQL
Previously I was using MAMP. However I had an issue installing the do_mysql
gem which is required for dm-mysql-adapter
I was using with Datamapper.
Long story short I found the easiest thing to do was install mysql via brew instead of using MAMP. So to start off:
brew install mysql
Next to configure the installation (all one line):
mysql_install_db --verbose --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
To get it to run on startup, first we have to create the directory if it doesn't exist:
mkdir -p ~/Library/LaunchAgents
Then we copy the mysql.plist over (the version number may have changed when you're reading this):
cp /usr/local/Cellar/mysql/5.5.20/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
Then we tell launchctl to load it on startup:
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Now to set the password:
mysqladmin -u root password {new-password}
Phew! Ok, now mysql is installed and running on port 3306. To create your first database simply enter:
mysqladmin -u root -p create {your-database-name}
And some gem love...
Finally I recommend using bundler
for gem management, foreman
to run your app (especially if you're on Heroku), rerun
to rerun your app when something changes, datamapper
for ORM and sinatra
for happiness.
Good luck!