WARNING: xcodeproj is not installed or is not configured properly (solved)

I set up my macOS for NativeScript following the instructions on official NativeScript documentation website.

When running ns run ios I got the error: WARNING: xcodeproj is not installed or is not configured properly.

Here's a fix:

sudo gem install -n /usr/local/bin xcodeproj && sudo gem install -n /usr/local/bin cocoapods