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!

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 Ruby on Rails 5 Basics Creating an App Creating a Rails App

sqlite3 error message not like the already stated issues.

Here is the error message in my command line - (Mac OS) after attempting to access localhost:3000:

Gem::LoadError (Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).): 

After a little research, I found that Homebrew already includes sqlite3 so I am confused as to why I am receiving this error.

Here is the info from the page I recieved

Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
Extracted source (around line #176):

            require path_to_adapter
          rescue Gem::LoadError => e
            raise Gem::LoadError, "Specified '#{spec[:adapter]}' for database adapter, but the gem is not loaded. Add `gem '#{e.name}'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord)."
          rescue LoadError => e
            raise LoadError, "Could not load '#{path_to_adapter}'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile.", e.backtrace

3 Answers

Jay McGavren
Jay McGavren
Treehouse Teacher

Erin Claudio When you installed Rails, did you follow the directions in this video? Most importantly, did you install Rails using the command gem install rails --version 5.0.0? The code shown in the course won't (all) work correctly unless you're using Rails 5.0.0 specifically.

I'm betting that when you installed Rails, an error was shown in the terminal output when installing the sqlite3 gem. Try this:

  • gem uninstall rails
  • gem install rails --version 5.0.0

Copy the output from this second command, and paste it into a reply to this forum post. So that it's formatted properly, be sure to use 3 backtick (`) characters on the line before the output, and again on the line after. See the "Markdown Cheatsheet" link on the reply form for more info.

Thank you for responding Jay!!

Yup Jay, I did (or at least I that is what I recall entering ) - I worked with a friend to find a solution and the version of sqlite3 had to be changed to '~> 1.3.6' in the gemfile.lock . I am now seeing the Rails version: welcome page.

Perhaps I did not enter 5.0.0 and maybe just 5.0?

Jay McGavren
Jay McGavren
Treehouse Teacher

Erin Claudio I think the gem tool only tries to match the minor version (5.0 versus 5.1) and will move up a patch version (5.0.7 versus 5.0.0) if it's available, so that should be fine. You would only have had problems if it had installed Rails 5.1 or later (and even those would have been fairly minor).

Glad to hear you found a fix!

24,704 Points

I found in my Gemfile I had to update

gem 'sqlite3'


gem 'sqlite3', '1.3.13'

Caleb Kleveter
Caleb Kleveter
Treehouse Moderator 37,862 Points

You might have already installed SQLite with Homebrew, but you still need to install the gem to your Rails project (or at least, that's what I get from the error message). I would try what the error is suggesting and add a sqlite3 entry to your project's gem file. I haven't done anything in Rails for years now, so I can't help much after that 🙂.

Thank you, Caleb, I will give it a try. This is very new ground for me !!