Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Missing Components - DB Tables

Why bin/rails?

Why bin/rails command to start rails server and not rails server command?

2 Answers

Jay McGavren
STAFF
Jay McGavren
Treehouse Teacher

We encourage everyone to use bin/rails rather than just rails because that loads the rails executable from within the bin/ subfolder of your app, ensuring you get the correct version. If you run rails all by itself, that could run any rails executable anywhere on your hard drive. (Well, anywhere that's in your $PATH environment variable.) That will work fine if you only have one version of Rails installed, but some systems may come with older versions of Rails pre-installed, and you don't want to run one of those by accident.

(BTW, bin/rails by itself won't do anything, but bin/rails server will run the server. Also, don't put a slash at the start: /bin/rails will look for a "bin" folder at the root of your hard drive, which probably doesn't exist. bin/rails, however, will look in the current folder.)

/bin/ it just absolute path. /bin/rails for older version. For Rails 5, "rails server" or "rails s" should do just fine.