1

I am trying to add ruby binaries to my path with this :

$ PATH=$PATH:/home/ehsan/.gem/ruby/2.3.0/bin

This works fine in that terminal session and I get :

$ rails -v
Rails 5.0.0

But after I close that terminal session and open new one and I enter rails :

$ rails -v
rails : command not found

Any ideas?

  • 1
    use export PATH=$PATH:/home/ehsan/.gem/ruby/2.3.0/bin and put that line in ~/.bashrc – Rahul Jul 27 '16 at 6:06
  • 1
    @Rahul No, not .bashrc. Don't set environment variables in .bashrc. – Gilles 'SO- stop being evil' Jul 27 '16 at 21:56
  • there's nothing wrong with setting env vars in ~/.bashrc. it's useful to set vars etc for both login and non-login environments, and can be sourced from ~/.bash_profile or ~/.profile. – cas Jul 28 '16 at 1:19
2

PATH is an environment variable like any other.

To make a permanent change, put it in the startup script for your shell. e.g. ~/.bashrc or ~/.bash_profile or for bash. or ~/.profile for bash and other bourne-like shells.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.