Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
How have you installed the "RoR stuff"? Using apt-get or through rvm? Which errors do you get? –  Salem Mar 11 '13 at 11:27
add comment

2 Answers

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

share|improve this answer
    
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. –  Scott Severance Mar 12 '13 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 '13 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. –  Scott Severance Mar 12 '13 at 22:41
add comment

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.

share|improve this answer
    
how can i do it, @Naha? my ~/.bashrc only shows me: PATH=$PATH:$HOME/.rvm/bin –  pzanetti631 Mar 12 '13 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 '13 at 9:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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