简体   繁体   中英

Rails, ZSH - rails and ruby command not found after installing ZSH terminal in ubuntu 20.04

I've already installed ruby and rails with rbenv and been using them. But after I've installed zsh terminal and type ' rails s' , 'ruby -v' , etc.., ZSH said 'command not found' .

I think it maybe because of zsh not knowing the 'Path'.

How can I add the ruby and rails paths to the ZSH in Ubuntu 20.04.

You could also try adding the following lines to your .zshrc file:

# Load rbenv if installed
export PATH="${HOME}/.rbenv/bin:${PATH}"
type -a rbenv > /dev/null && eval "$(rbenv init -)"

I've found the answer.

I run these and works perfectly.

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshenv
echo 'eval "$(rbenv init -)"' >> ~/.zshenv
echo 'source $HOME/.zshenv' >> ~/.zshrc
exec $SHELL

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM