postmodern / chruby

Changes the current Ruby
MIT License
2.88k stars 189 forks source link

chruby not available system-wide #494

Closed msuzoagu closed 1 year ago

msuzoagu commented 1 year ago

Description

chruby command not available to deploy_user on Ubuntu 22.04

Steps To Reproduce

Followed the following steps to install chruby system-wide:

  1. wget -P /tmp https://github.com/postmodern/chruby/releases/download/v0.3.9/chruby-0.3.9.tar.gz
    cd /tmp
    tar -xzvf chruby-0.3.9.tar.gz
    cd chruby-0.3.9/
    sudo make install

The added the below:

2.

  if [ -n "$BASH_VERSION" ] || [ -n "$ZSH_VERSION" ]; then
    source /usr/local/share/chruby/chruby.sh
  fi

to /etc/profile.d/chruby.sh , which according to the guide should ensure system-wide availability.

  1. Created a deploy_user via sudo adduser --disabled-password deployer
  2. Switch to deploy_user via sudo su deployer
  3. run chruby --version as deploy_user

Expected Behavior

Expect chruby command to be available to deploy_user:

deployer@ip-address:~$ chruby -h
usage: chruby [RUBY|VERSION|system] [RUBYOPT...]

Actual Behavior

deployer@ip-address:~$ chruby
chruby: command not found

Environment

$ bash --version
` version 5.1.16(1)-release (x86_64-pc-linux-gnu)`

$ chruby --version
    `chruby: 0.3.9`

$ ruby --version
    `Ruby isn't installed yet`

$ gem --version
    `Ruby isn't installed yet`

$ gem env
    `Ruby isn't installed yet`
msuzoagu commented 1 year ago

resolved by restarting shell as outlined here