Trouble With Rails First Build


#1

I’ve just started The Odin Project and am working on my first Rails application. I see in the instructions that it reads “Do NOT use sudo unless The Odin Project specifically says to do so.” However, in my terminal on my Mac it keeps prompting me to use sudo, saying, “Rails is not currently installed on this system. To get the latest version, simply type: $ sudo gem install rails. You can then rerun your “rails” command.” No matter how many times I try to get around this issue by typing in “rails generate scaffold car make:string model:string year:integer,” my terminal keeps telling me to use sudo and I can’t bypass this prompt. Does anyone have any fixes for this? I’ve tried googling to solve the issue on my own and can’t at this time. Thanks in advance for any advice!


#2

it seems that you haven’t installed ruby. you can refer the lesson below to install them.
I hope it works.

https://www.theodinproject.com/courses/web-development-101/lessons/installing-ruby


#3

It’s odd as it’s saying that it’s already installed. “macbookpro$ rbenv install 2.6.3 --verbose
rbenv: /Users/macbookpro/.rbenv/versions/2.6.3 already exists
continue with installation? (y/N)”

I’m going to continue troubleshooting to figure this out. Thank you!


#4

when you run the commands below; what does that say?

ruby -v
rails -v


#5

For Ruby it says:
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-darwin16]

And for Rails it says:
Ignoring bindex-0.8.1 because its extensions are not built. Try: gem pristine bindex --version 0.8.1
Ignoring bootsnap-1.4.4 because its extensions are not built. Try: gem pristine bootsnap --version 1.4.4
Ignoring byebug-11.0.1 because its extensions are not built. Try: gem pristine byebug --version 11.0.1
Ignoring childprocess-1.0.1 because its extensions are not built. Try: gem pristine childprocess --version 1.0.1
Ignoring ffi-1.11.1 because its extensions are not built. Try: gem pristine ffi --version 1.11.1
Ignoring msgpack-1.3.1 because its extensions are not built. Try: gem pristine msgpack --version 1.3.1
Ignoring puma-3.12.1 because its extensions are not built. Try: gem pristine puma --version 3.12.1
Ignoring sqlite3-1.4.1 because its extensions are not built. Try: gem pristine sqlite3 --version 1.4.1
Rails 6.0.0.rc1
Macbooks-MacBook-Pro:~ macbookpro$ rails -v
Ignoring bindex-0.8.1 because its extensions are not built. Try: gem pristine bindex --version 0.8.1
Ignoring bootsnap-1.4.4 because its extensions are not built. Try: gem pristine bootsnap --version 1.4.4
Ignoring byebug-11.0.1 because its extensions are not built. Try: gem pristine byebug --version 11.0.1
Ignoring childprocess-1.0.1 because its extensions are not built. Try: gem pristine childprocess --version 1.0.1
Ignoring ffi-1.11.1 because its extensions are not built. Try: gem pristine ffi --version 1.11.1
Ignoring msgpack-1.3.1 because its extensions are not built. Try: gem pristine msgpack --version 1.3.1
Ignoring puma-3.12.1 because its extensions are not built. Try: gem pristine puma --version 3.12.1
Ignoring sqlite3-1.4.1 because its extensions are not built. Try: gem pristine sqlite3 --version 1.4.1
Rails 6.0.0.rc1


#6

What’s the output of echo $PATH in your terminal.

It may be that you just need to set the global ruby version with rbenv global 2.6.3

After that you can run gem install rails


#7

I will try this, thank you! Everything has been running really smoothly, so it’s a mystery to me why rails is acting up on my Mac.


#8

i followed through the steps below just to make sure but it worked ok for me.

5. Installing Ruby
6. Setting Up Git
7. Project: Your First Rails Application