Photo reblogged from Chasing Vivid Dreams with 441 notes
Always try to… Always suck at it!
Source: iheart-photos
Post with 7 notes
Through my journey trying ot install RoR on Snow Leopard, I faced troubles and I had to search for them which lead me to multiple blog poasts and websites. So I’ll try to collect them in one blog post here for you.
Before installing Ruby on Rails you have to decide if you will need to test your project against different gem versions or if you have multiple projects written with different versions of RoR. If so, it is preferable to use RVM to manage these multiple instances of RoR versions.
In this tutorial I’m going to cover how to install RoR using RVM. You have to have both Xcode (comes with optional software on your Snow Leopard DVD) and git before installing RVM. Insert your Snow Leopard DVD and install Xcode from the optional software folder. To install git, go to this page and download your preferred version (current latest is v1.7.5.1):
http://code.google.com/p/git-osx-installer/downloads/list?can=3
Then go to terminal and paste this command:
$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
To load RVM into your shell sesions, using the text editor of your choice create a file in your home directory named “.bash_profile” without quotations. Then in Terminal, paste this command:
$ echo ‘[[ -s “$HOME/.rvm/scripts/rvm” ]] && . “$HOME/.rvm/scripts/rvm” # Load RVM function’ » ~/.bash_profile
Note: The ‘.’ in the beginning of the file name is to make it a hidden file.
If you’re using textmate you can create the file through terminal by using the following command:
$ mate ~/.bash_profile
and then paste the previous command in the created file.
To load the new shell function to your terminal session you can restart Terminal (Cmd+Q and re-open terminal again) or you can reload your current shell by using the following command:
$ source ~/.bash_profile
To verify the successful operation, type
$ type rvm | head -1
You should see ‘rvm is a function’. Sometimes installation could be unsuccessful. Topics on the internet suggested that if your ~/.rvm/scripts is empty or nonexistent, your installation failed but if it’s there, it’s successful.
Personally it took me 3 times to install RVM successfully and get it working. My scripts subfolder was always there yet the previous check still gave me an ‘RVM not found’ error. If it fails on your side too, delete the ~/.rvm folder (using terminal command: $ rm -rf .rvm) and try reinstalling.
When you get your ‘rvm is a function’ message, you can proceed with installing ruby.
$ rvm list known #Gets a list of known ruby versions
$ rvm install 1.9.2 #Installs ruby 1.9.2. Optionally add ‘—default’ to set this version as the default for new shells
$ rvm use 1.9.2 #To use ruby 1.9.2
$ ruby -v #Checks whether the operation was successful
Note: if you want to install a certain version just change the version number. Also if you want a crtain revision, say p180, add it to your commands. (ex: $ rvm install 1.9.2-p180
To install rails type:
$ gem install rails #You can define a specific version if you don’t want the latest release. for ex: $ gem install rails -v 2.3.11
If you’re going to use use MysQL you can install its gem by pasting the following commands to terminal and entering your password.
$ sudo env ARCHFLAGS=”-arch i386” gem install mysql — \
—with-mysql-dir=/usr/local/mysql —with-mysql-lib=/usr/local/mysql/lib \
—with-mysql-include=/usr/local/mysql/include
$ export PATH=”/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH” » ~/.bash_profile
After that reload your terminal (Cmd+Q and reopen or $ source ~/.bash_profile )
Sources:
Page 1 of 9