Recently, I encountered an error when installing gems. I was working on a new pet project, and I tried to install gems dependencies through Bundler.
One of the gems being installed was “json” with version 1.8.3 as a dependency of one of the gems needed in my project. For some reason, it throws an error when installing that gem; “Error installing json 1.8.3 with native extensions”.
I poked around and searched through the internet. Most of them just tell you to install json 1.8.3 in your main gems path, the path to where the gems are installed if you don’t use Bundler (if there is a better term for this, please let me know in the comments), as the error message suggests, but I thought that this should not be because one of the reasons for using Bundler was to decouple gems dependencies and have each project handle their own gems dependencies.
So I poked around a little more, and then I came across a thread that suggested installing the Xcode command line tools (sorry, I forgot to document where I found that!). So to solve the issue, I just needed to install Xcode command line tools through the following terminal command:
After executing the above command, I was able to successfully install json 1.8.3 together with my other gems dependencies!
Hope this helps someone out there who’s encountering the same problem.