开发者

Why can't I access to Rails via multiples shells bash and zsh on OSX Lion

I installed Ruby on Rails 3 using bash on OSX Lion.

When I wanted to use zsh and do a "rails -v" command I had "Rails is not currently i开发者_如何学Gonstalled on this system".

I just do not understand why. To me it's like "you can access all the files you want with bash not with zsh".

If I want to switch to zsh, will I have to install one more time Rails? delete the old one?

Is it secure and clever to use two shells when developing Rails applications? What are your best practices?

Thanks in advance.

PS: I am new to programming and my installation is working fine. I even created one app.

EDIT: If you encounter the same problem I would encourage you to read the second answer first to get the rationale then the first one. Thanks to both of them.


While you are running bash, type at the command line echo $PATH.

Now start up your zsh command line, and type echo $PATH.

I bet the Rails path is not included in your zsh, right?

Look in your $HOME dir for .bash* files. See which one has the Rails PATH added.

Find your zsh .* env files and copy/paste the line you found above into the approriate file.

When I say .bash* and .* files, I mean hidden files in your home dir that you'll only find by doing ls -la. If you find a .profile file, that would be a good place to insert this.

I hope this helps.

P.S. as you appear to be a new user, if you get an answer that helps you please remember to mark it as accepted, and/or give it a + (or -) as a useful answer.


I just do not understand why. To me it's like "you can access all the files you want with bash not with zsh".

As shellter said, you must have directories added to your path in order to run commands from the command line. For more information on PATHs take a look at the Intro to Linux guide. I know you are not using Linux but that section (and lots of others) is very much applicable.

If I want to switch to zsh, will I have to install one more time Rails? delete the old one?

No, see note on paths above and take a look at the guide.

Is it secure and clever to use two shells when developing Rails applications? What are your best practices?

It's not really something special to use two shells at once. It depends what you do in each. I often have 6 and 7 shells open, not all for the same thing. That is really up to you and how you work. The number of shells you use is more of a workflow thing than a "best-practices" issue.

I normally have 3 shells open when I do RoR work. One running autotest in the background, one running rails -server, and one where I actually edit files and run emacs. But again, this is not best practice as it is workflow. Do whatever makes you effective.

The only trouble you could get into occasionally running two shells is say, for example, you open a file in one and delete it in another. However, when you do this it is typically very obvious.

PS: I am new to programming and my installation is working fine. I even created one app.

For Rails, I found this tutorial very helpful.

Also, you said you were new to programming. I don't know if this is the case, but I would suggest starting with basic Ruby, before jumping into Perl. Although the tutorial I linked above covers Rails-flavored Ruby.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜