Fix Cannot Find Header Files For Ruby Error

«  An idea about RootViewController in iOS
Custom Xcode Header Comment  »

Error Description

Recently when I try to update our project Gemfile.lock, I got an gem install json errror:

installJson

Then by following the instruction of the error, I try to run:

sudo gem install json -v '2.3.0' --source 'https://rubygems.org/'

Then it appears another error 🀯

rubyHeader

So, by reading the error description, it looks like there is some problems on my ruby settings. But when I checked, I found it is a MacOS 10.14 specific error. πŸ™

It looks like some development files got moved, or stopped getting installed by some reason …

Solution

By searching how to fix it, somebody suggested to:

xcode-select --install
sudo xcodebuild -license

Although I run it, it looks like the CommandLine tools of Xcode still not get installed correctly.

Then I tried

open /Library/Developer/CommandLineTools/Packages/

It shows I don’t have this folder.

Restart the computer !!! 😑

Then, try to get into the folder again! This time successeed!!! 🀠

macOSHeader

Follow the installation, after it is finished. Test the previous gem install json command again:

sudo gem install json -v '2.3.0' --source 'https://rubygems.org/'

TADA! Success!! πŸ₯³

Reference

https://github.com/castwide/vscode-solargraph/issues/78

Published on 20 Dec 2019 Find me on Facebook, Twitter!

«  An idea about RootViewController in iOS
Custom Xcode Header Comment  »

Comments

    Join the discussion for this article at here . Our comments is using Github Issues. All of posted comments will display at this page instantly.