rvm installation not working: “RVM is not a functi

2019-01-01 09:41发布

I just installed RVM, but can't make it work. I have such line at the end of my .profile file:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

I tried to run source .profile and restarting terminal, but still, when I run rvm use 1.9.2 I'm getting:

RVM is not a function, selecting rubies with 'rvm use ...' will not work.

My system is Ubuntu 11.10.

标签: ruby rvm
20条回答
初与友歌
2楼-- · 2019-01-01 10:04

Procedure for installing Ruby 1.9.3-p125 on Mac OSX 10.8 Mountain Lion

  1. You've already installed the latest XCode (>= 4.3) and and the command line Objective-C compiler "clang".
  2. You must run the "bash" shell for this procedure to work.
  3. Go to System Preferences
  4. Click on "Users & Groups"
  5. Click the lock on the bottom left of the panel and enter your password to unlock it.
  6. "Ctrl-Click" on your user icon in the left pane of the panel and choose "Advanced Options..."
  7. Change the Login Shell to "/bin/bash"
  8. Close the preferences
  9. Open a terminal window (press command+spacebar and type in "terminal")
  10. Follow the instructions at:

http://www.frederico-araujo.com/2011/07/30/installing-rails-on-os-x-lion-with-homebrew-rvm-and-mysql/

Notes:

  • To install ruby, you may need to specify the clang compiler:

    $ rvm install 1.9.3p125 --with-gcc=clang

  • If RVM gripes about /usr/local/rvm not found, you need to create a link:

    $ ln -s /Users/[your user name]/.rvm /usr/local/rvm

查看更多
看淡一切
3楼-- · 2019-01-01 10:06

You are not using an login shell.

The process of enabling the login flag is described here, also some details on what a login shell is can be found here.

Thus, you need to check the option "Run as login shell" in the Gnome terminal's settings. It is required to open new terminal after this setting the flag.

Sometimes it is required to set the command to /bin/bash --login.


For remote connections it is important to understand the differene between running interactive ssh session and executing single commands.

While running ssh server and then working with the server interactively you are using login shell by default and it's all fine, but for ssh server "command" you are not using login shell and it would be required to run it with ssh server 'bash -lc "command"'.

Any remote invocation can have the same problem as executing single command with ssh.

查看更多
长期被迫恋爱
4楼-- · 2019-01-01 10:06

To permanently resolve this just cut/paste following line:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

From: ~/.bash_profile file

To: ~/.bashrc file

Reason this works is that .bashrc is executed each time you enter terminal, and .bash_profile each time you login. That is why solution /bin/bash --login works, but you have to do that each time you enter terminal. This way you are set until your next format, and you will forget all this by then :)

查看更多
无色无味的生活
5楼-- · 2019-01-01 10:07

I had this problem too on a fresh rvm installation, and non of the answers here fixed it. Going into the official rvm site, on the basics section, they have this command:

# from http://rvm.io/rvm/basics

source $(rvm 1.9.3 do rvm env --path)

You should change 1.9.3 for the ruby version that you actually want, and it'll make rvm a function regardless of the shell type.

查看更多
泪湿衣
6楼-- · 2019-01-01 10:07

For those who comes with same issue and they are using lubuntu like me I followed this link :

You start your terminal with

lxterminal -e "bash -il"

Thank to @mpapsis who pointed me to the right direction

查看更多
孤独总比滥情好
7楼-- · 2019-01-01 10:11

« Official » instructions are there: https://rvm.io/integration/gnome-terminal/

查看更多
登录 后发表回答