I am using Rails and for some reason unbeknownst to me I have to execute the following line every time I start the terminal in order to use ruby and rails.
If I type the following before running the above command, it will recommend that I install the packages (ie "type 'sudo apt-get install package' to install")
rails -v && ruby -v && irb -v
Is there a way to make my terminal execute a command upon opening? Or, better yet, can anybody help explain the reason I have to run this line? I found an article that said I had to do that given my issue but it didn't explain why.
Assuming you're using the
bash shell, then
~/.bash_profile will be sourced once (and only once) when you log in to the system but not each time you open a terminal window.
~/.bashrc, however, will be sourced every time a new shell is opened (i.e. when you open a terminal window).
So they are probably some environment variables settings in
~/.bash_profile which are required for
ruby to run. Those settings should be moved to the
~/.bashrc file instead so they are defined in all shell instances.
source ~/.bash_profile from your
~/.bashrc (this is at your own risk, it may have side-effects).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!Donate Us With