Search code examples
rubypathrbenv

How to point PATH to new version of ruby on Mac OS X to connect Octopress


I am on a Mac OS (10.8.4), so have the system version of ruby installed (1.8.7). I know I can't remove it because it's required for my system. However, I am interested in setting up a Jekyll blog on GitHub via Octopress: http://octopress.org. It requires ruby version 1.9.3, so I added it via

rbenv install 1.9.3-p385

It appears to have worked (after a few hours before realizing I had to uninstall and old version of wine via macports). However, when I run

localhost:~ Dan$ ruby -v

I get

ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.4.0]

I used to get

ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

but then I run

git clone git://github.com/imathis/octopress.git octopress
localhost:~ Dan$ cd octopress

and get

ruby-1.9.3-p448 is not installed.
To install do: 'rvm install ruby-1.9.3-p448'

I'm using rbenv rather than rvm (but would be willing to switch if it made a difference). Now I run:

localhost:octopress Dan$ env CC=gcc rbenv install 1.9.3-p448
Downloading yaml-0.1.4.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/36c852831d02cf90508c29852361d01b
Installing yaml-0.1.4...
Installed yaml-0.1.4 to /Users/Dan/.rbenv/versions/1.9.3-p448

Downloading ruby-1.9.3-p448.tar.gz...
-> ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p448.tar.gz
Installing ruby-1.9.3-p448...
Installed ruby-1.9.3-p448 to /Users/Dan/.rbenv/versions/1.9.3-p448

Then

localhost:octopress Dan$ ruby --version
rbenv: version `1.9.3' is not installed

running

which ruby
/Users/Dan/.rbenv/shims/ruby

I'm not sure if there's something wrong with my PATH (echo $PATH)

/Users/Dan/Library/Enthought/Canopy_64bit/User/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:/Users/Dan/.rbenv/shims:/Users/Dan/.rbenv/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/texbin:/Users/Dan/scripts:/usr/local/mysql/bin:/Users/Dan/.rvm/bin

Anyone have an idea of how I can get Octopress working and connecting properly to the appropriate version of Ruby?


Solution

  • For some reason

    rbenv global 1.9.3-p448
    

    did not work to set my ruby default within the octopress folder but when I ran the local

    rbenv local 1.9.3-p448
    

    everything worked.