Topher Hunt
Topher Hunt

Reputation: 4804

Mac OSX: Ruby gem compile error: "You have to install development tools first"

Running bundle install for a Rails project on Ruby 2.3.0, I keep hitting gem compile errors that contain the line You have to install development tools first. Googling around, the most immediate solution is to run xcode-select --install, but I already have Xcode installed (running that command confirms it) and I've compiled earlier versions of these gems (on earlier Ruby versions) without problem before.

What else could be causing this compile error?

Upvotes: 6

Views: 7101

Answers (1)

Topher Hunt
Topher Hunt

Reputation: 4804

When (as recommended by the bundler error) you try installing the problem gem by itself (eg. gem install bcrypt -v '3.1.11'), often the displayed error message will be more detailed and more helpful than the one shown in the bundle install output.

In this case, the error message mentioned something about accepting the Xcode license agreement. It turns out a recent OSX update gave me a new version of Xcode, and I hadn't yet accepted the new license. On OSX you can accept the agreement by running sudo xcodebuild -license. Once I ran this and accepted the terms, I was able to compile and install that gem with no errors.

Upvotes: 6

Related Questions