Skip to content

Instantly share code, notes, and snippets.

@mpapis
Forked from behrangsa/gist:2181303
Created March 24, 2012 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpapis/2182557 to your computer and use it in GitHub Desktop.
Save mpapis/2182557 to your computer and use it in GitHub Desktop.
Installing Ruby 1.8.7 via RVM in OS X 10.7 Lion + XCode 4.2+
  • Install MacPorts
  • Install apple-gcc-42 via MacPorts: sudo port install apple-gcc-42
  • Install RVM: bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )
  • Install Ruby 1.8.7 using apple-gcc-42: rvm install 1.8.7 --with-gcc=/opt/local/bin/gcc-apple-4.2
  • Enjoy!
@behrangsa
Copy link

@MAPIS: the latest RVM stable looks buggy to me. Installed it on a brand new OS X Lion machine and it caused .profile not to be sourced when opening a new Terminal window.

@mpapis
Copy link
Author

mpapis commented Mar 24, 2012

this is not bug, this is intended behavior, you should not use .profile instead of .bash_profile this two files serve different purposes

read https://rvm.beginrescueend.com/support/faq/#shell_login for more details

@behrangsa
Copy link

This doesn't make sense to me. MacPorts adds the following chunk to .profile:

# MacPorts Installer addition on 2011-12-25_at_03:50:40: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.

And if I don't install RVM, it gets sourced every time I open a new Terminal window. As soon as I install RVM it doesn't get sourced anymore.

@mpapis
Copy link
Author

mpapis commented Mar 24, 2012

@behrangsa then it's a bug in MacPorts, .profile is the last file listed to be read for login bash - and this is only to keep compatibility with sh, you can manually move this line to ~/.bash_profile or ~/.bash_login - the one that was created by RVM

@behrangsa
Copy link

@mpapis: I mean, as soon as I installed the latest stable version of RVM. Otherwise 1.10.2 won't cause any issues.

@behrangsa
Copy link

@mpapis: I assume this is a change in the latest version of RVM, is this correct? As 1.10.2 doesn't cause any issues for me.

@mpapis
Copy link
Author

mpapis commented Mar 24, 2012

@behrangsa yes we instantly improve how RVM works including the way it initializes shell and makes everything working, that's why it stopped working for you, it's not going to change, we need to use the tools we have the right way - otherwise who will save us from all the bugs ?

@behrangsa
Copy link

@mpapis: I think when RVM does not find already existing ~/.bash_profile or ~/.bash_login files and creates them itself, it should add a line to source ~/.profile as well.

@behrangsa
Copy link

Or maybe I am wrong! :) Let me share this with MacPorts guys...

@mpapis
Copy link
Author

mpapis commented Mar 24, 2012

it's not so obvious and not so easy to implement(the additional line), it's basically so bad idea to use the last file from the list

as implication of using .profile - on linux it's used via sh for login managers which breaks things badly when used with RVM (not sure about OSX)

@behrangsa
Copy link

@mpapis: one question: So when bash sees ~/.bash_profile or ~/.bash_login, it doesn't source .profile anymore? But when they don't exist, it sources ~/.profile?

@mpapis
Copy link
Author

mpapis commented Mar 24, 2012

quoting man bash:

   When  bash  is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the
   file /etc/profile, if that file exists.  After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that  order,  and  reads
   and executes commands from the first one that exists and is readable.  The --noprofile option may be used when the shell is started to inhibit this behav-
   ior.

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