Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gem installation error: You have to install development tools first

This worked for me:

sudo xcode-select -switch /


Have you run:

xcode-select --install

To install the Xcode Developer tools?


I was having this issue on MacOS Mojave(10.14.1). Installing latest ruby via Homebrew and setting some env variables solved it for me:

(copied from brew info ruby instructions)

export PATH="/usr/local/opt/ruby/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/ruby/lib"
export CPPFLAGS="-I/usr/local/opt/ruby/include"
export PKG_CONFIG_PATH="/usr/local/opt/ruby/lib/pkgconfig"

I ran into this same problem on Ubuntu 18.04. The fix on Ubuntu was to install the ubuntu-dev-tools package:

$ sudo apt-get install ubuntu-dev-tools