1

I installed the latest RVM - Ruby Version Manager - and installed Ruby 1.8.7 and 1.9.3 on OSX Lion with XCode 4.3.3 using clang rvm install 1.9.3 --reconfigure --debug -C --enable-pthread --with-gcc=clang as the regular way did not work due to a GCC error. I did get one error clang: error: unsupported option '--with-libyaml, but Ruby 1.9.3 worked and I could run WPScan that needs at least 1.9.2 . But now every time I run a command to change folder such as cd I get a long Bash script printed related to RVM - see http://pastebin.com/UAm38Vcm and: Bash Display after cd command.

How can I stop it from doing that?

Update I

Added a comment at RVM at Github as well https://github.com/wayneeseguin/rvm/issues/1039 , but as that issue is not 100% related and as I need this solved as soon as possible I opened a thread here with more data.

Update II

I realized the RVM Initialization script is the one that is being printed: https://github.com/wayneeseguin/rvm/blob/master/scripts/initialize . No idea why though..

Update IV

My .bashrc

# define aliases
alias sudo='sudo '
#alias ruby='ruby1.9'
alias apacherestart='sudo apachectl -k restart'

# define hist properties
HISTFILESIZE=1000000000
HISTSIZE=1000000

# define path to programs
PATH=/opt/local/bin:opt/local/sbin:/opt/subversion/bin:/opt/local/apache2/bin/:/opt/local/lib/python2.4/site-packages/django/bin:$PATH

# define manpath
MANPATH=/opt/local/share/man:$MANPATH

# export env vars
export HISTFILESIZE HISTSIZE PATH MANPATH
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

My .bash_profile

source ~/.bashrc
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
rhand
  • 1,176
  • 4
  • 17
  • 45
  • 1
    This only happens for `cd` and not other commands? If you open a new terminal, does it do it, too? What do `echo "$PS1"` and `echo "$PROMPT_COMMAND"` output? What does `type -a cd` say? – Dennis Williamson Jul 14 '12 at 06:10
  • @DennisWilliamson `echo "$PS1" echo "$PS1" \h:\W \u\$ update_terminal_cwd;` and `echo "$PROMPT_COMMAND" echo "$PROMPT_COMMAND" update_terminal_cwd; update_terminal_cwd;` Typing `type -a cd` prints the whole RVM script. – rhand Jul 14 '12 at 06:14
  • When I open a new terminal it does not happen. I will just see `Last login: Sat Jul 14 12:13:00 on ttys001 You have new mail. jaspersmbp:~ jasper$ ` – rhand Jul 14 '12 at 06:20
  • Try `unset -f cd` or `unalias cd`. – Dennis Williamson Jul 14 '12 at 06:20
  • If `type -a cd` outputs anything other than "cd is a shell builtin" then `cd` is aliased or a function has been created named "cd" (it's possible on some systems that it will also output a filesystem location but you can ignore that). – Dennis Williamson Jul 14 '12 at 06:29
  • `[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*` was added to `.bash_profile` . This must be part of the issue, but was added by RVM – rhand Jul 14 '12 at 06:30
  • 1
    Since it doesn't happen in a new terminal, you don't need to worry about startup files like `.bashrc` and thus the question is essentially moot. Close the terminal and open a new one. Done. – Dennis Williamson Jul 14 '12 at 06:31
  • See updated question with `.bash_profile`. Is it caused by the line added by RVM? RVM did not add it there for no reason.. – rhand Jul 14 '12 at 06:33
  • What's in `$HOME/.rvm/scripts/rvm`? See my previous comment. – Dennis Williamson Jul 14 '12 at 06:34
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/13877/discussion-between-rhand-and-dennis-williamson) – rhand Jul 14 '12 at 06:37

2 Answers2

2

Your cd command has somehow become aliased or a function has been created named "cd".

You can undo those with either:

unalias cd

or

unset -f cd
Dennis Williamson
  • 346,391
  • 90
  • 374
  • 439
  • Thanks for all the comments and tips. Somehow cd got aliased. All good now after I opened a new terminal. Also was able to load Ruby of choice again using `rvm use 1.9.3`. – rhand Jul 14 '12 at 06:46
1

You should be able to revert temporarily with

unalias cd

It appears that you will need to figure out what was changed in your .bashrc and revert all those changes. If the installation script is at all sanely written, it should have made backups, or document somehow what was changed.

tripleee
  • 175,061
  • 34
  • 275
  • 318
  • `[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*` was added to `.bash_profile` which is needed to work with RVM. Dennis and you mention `unalias cd` . Not sure how that helps.. `.bashrc` had no changes except for the commenting of a ruby alias `#alias ruby='ruby1.9'` – rhand Jul 14 '12 at 06:25
  • `.rvm/scripts/rvm` apparently includes functionality to alias out `cd`. The line from `.bash_profile` is what you need to remove, yes. – tripleee Jul 14 '12 at 07:16