[英]RVM installed ruby not found after restart of shell Ubuntu 16
I've installed RVM and ruby and at first it seemed to work, but whenever I open a new shell tab or window only rvm can be found, not ruby. 我已经安装了RVM和ruby,起初它似乎工作,但每当我打开一个新的shell选项卡或窗口时,只能找到rvm,而不是ruby。
Running rvm -v
gives me a nice little output: 运行
rvm -v
给了我一个不错的小输出:
rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
but running ruby -v
, gem -v
or rails -v
gives me an error telling me to apt-get install ruby/rails
. 但运行
ruby -v
, gem -v
或rails -v
给我一个错误告诉我apt-get install ruby/rails
。
I've installed rvm through the following commands: 我通过以下命令安装了rvm:
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
I installed ruby like so: 我这样安装ruby:
rvm install 2.3.1
rvm use 2.3.1 --default
Rails was installed with the command: 使用以下命令安装Rails:
gem install rails
I've checked my .bashrc
.bash_profile
and my .profile
and it's set up nicely with the following: 我已经检查了我的
.bashrc
.bash_profile
和我的.profile
,它与以下设置很好:
.bashrc
and .profile
: .bashrc
和.profile
:
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
.bash_profile
: .bash_profile
:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
Running the line source ~/.rvm/scripts/rvm
allows ruby
, gem
, and rails
to be found again, but you have to repeat this is every new tab or window. 运行行
source ~/.rvm/scripts/rvm
可以再次找到ruby
, gem
和rails
,但是必须重复这个是每个新的选项卡或窗口。
rvm
installed modules will work automatically? rvm
安装的模块能够自动运行? Turns out everything is set up nicely and correct. 事实证明一切都设置得很好而且正确。 If you have this issue it's an issue with your shell settings.
如果您遇到此问题,则表明您的shell设置存在问题。 You need to set your profile to login shell .
您需要将您的配置文件设置为登录shell 。
Access your settings by going to the menu and pic Terminal > Preferences
. 通过进入菜单和图片
Terminal > Preferences
访问您的设置。
In the window that pops up, select Profiles
in the tab menu. 在弹出的窗口中,选择选项卡菜单中的
Profiles
。 Pick if you want to create a new profile or edit the existing default one. 选择是否要创建新配置文件或编辑现有默认配置文件。 In the window that comes up (it's the same regardless of your pic) go to the tab
Command
and enable Run command as a login shell
. 在出现的窗口中(无论您的图片如何都是相同的)转到选项卡
Command
并启用Run command as a login shell
。
Restart your terminal and you should find that your rvm commands are now working. 重新启动终端,你会发现你的rvm命令现在正在运行。
What about adding to your .profile or .bashrc 如何添加到.profile或.bashrc
echo "source $HOME/.rvm/scripts/rvm" >> ~/.profile
EDIT 编辑
You need to call source from either .profile or .bashrc NOT .bash_profile 您需要从.profile或.bashrc NOT .bash_profile调用source
jperez@asus-kubuntu16:~$ grep bash_profile .profile
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
jperez@asus-kubuntu16:~$
In Deepin Terminal run: sudo nano ~/.config/deepin/deepin-terminal/config.conf
在Deepin终端运行:
sudo nano ~/.config/deepin/deepin-terminal/config.conf
and change run_as_login_shell=false to true 并将run_as_login_shell = false更改为true
> sudo apt-get update
> sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
> sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
> gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
> \curl -sSL https://get.rvm.io | bash -s stable
> source ~/.rvm/scripts/rvm
> rvm install 2.3.1
> rvm use 2.3.1 --default
> ruby -v
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.