0

I just installed Ruby and Rails stuff on my machine, and start to learn.

But every time I close the Terminal and re-open it, I have to re-type the command . ~/.bash_profile in order to run Rails commands properly...

How can i fix this, to close and re-open the Terminal, ready to develop my Rails apps?

1
  • How have you installed the "RoR stuff"? Using apt-get or through rvm? Which errors do you get?
    – Salem
    Mar 11, 2013 at 11:27

2 Answers 2

1

Try to set your PATH varible inside "~/.bashrc" file, which gets executed every time a bash shell is started.

Thus the PATH to your rails bin directory is set and every command inside that is visible in your shell.

I hope this would help.

2
  • how can i do it, @Naha? my ~/.bashrc only shows me: PATH=$PATH:$HOME/.rvm/bin Mar 12, 2013 at 17:50
  • @PauloZanetti In that case you can find the PATH set in your ~/.bash_profile and add it here. In general, if you have some executable in a dir to be used as a command without specifying absolute path, add its absolute path with the file name in PATH variable.
    – Naha
    Mar 15, 2013 at 9:57
1

Most likely your terminal is not invoking the shell as login shell. This inhibits the sourcing of your ~./bash_profile.

To fix this issue fix the terminal configuration.

For gnome-terminal e.g. look at this screenshot: enter image description here

3
  • Making the terminal start a login shell every time defeats the purpose of having a login shell. It'd be better to put the configuration on the correct file instead, as in Naha's answer. Mar 12, 2013 at 8:45
  • @ScottSeverance the official RVM docs say you need to run it as a login shell. Yes, putting it in the other files works, but it can be a pain later on to debug problems that arise because of it not being a login shell m
    – jrg
    Mar 12, 2013 at 12:41
  • In that case, logging out and back in would seem to be to proper solution. I haven't read the RVM docs, bit it seems a little silly for them to need a login shell. Mar 12, 2013 at 22:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .