Skip to content

Instantly share code, notes, and snippets.

@jasoncodes
Created September 17, 2011 07:45
Show Gist options
  • Save jasoncodes/1223731 to your computer and use it in GitHub Desktop.
Save jasoncodes/1223731 to your computer and use it in GitHub Desktop.
Installing Ruby 1.9.3 with rbenv on OS X
# The latest version of this script is now available at
# https://github.com/jasoncodes/dotfiles/blob/master/aliases/rbenv.sh
VERSION=1.9.3-p286
brew update
brew install rbenv ruby-build rbenv-vars readline ctags
if [ -n "${ZSH_VERSION:-}" ]; then
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.zshrc
else
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.bash_profile
fi
eval "$(rbenv init - --no-rehash)" # load rbenv in the current shell
CONFIGURE_OPTS="--disable-install-doc --with-readline-dir=$(brew --prefix readline)" rbenv install $VERSION
rbenv global $VERSION
gem install --no-ri --no-rdoc bundler rbenv-rehash git-up hitch gem-browse gem-ctags cheat awesome_print pry
gem ctags
@nielsenrechia
Copy link

Hy man, I finished it, now i'm using ruby 1.9.3 correctly, but my terminal when open always sets down and I have to put it exe c $SHELL, So when I close the terminal and reopen it, I need to put exec $SHELL again to sets it up. I don't know if you will understand me

@jasoncodes
Copy link
Author

@nielsenrechia exec $SHELL reloads your current shell and it generally should do roughly the same thing as opening a new terminal. Perhaps these two things are loading different configuration files. Try adding the rbenv init line that is now at the bottom of your ~/.bash_profile to your ~/.bashrc as well.

@nathanaelkane
Copy link

To install older versions of Ruby (e.g. 1.9.2), I first had to install the official GCC compiler: https://github.com/kennethreitz/osx-gcc-installer/downloads

@timoxley
Copy link

timoxley commented Nov 5, 2012

You should prolly add brew update to the start of the list of commands.

@timoxley
Copy link

timoxley commented Nov 5, 2012

and this could be more sexy-like: brew install rbenv ruby-build rbenv-vars readline ctags

@jasoncodes
Copy link
Author

@timoxley Cheers. Updated.

@TonyJHopkinson
Copy link

Thank you. Scratching my head for a while. No one else mentioned rbenv-vars.

@snowleung
Copy link

helpful! thank you. i use "brew install rbenv ruby-build rbenv-vars readline ctags" and "rbenv -global xxx" fix my upgrade ,do you know why i use rbenv upgrade it but still at old version? anyway , it's work! thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment