i386 arch error installing old scrypt gem version with OS X Mojave

I was experiencing this exact problem.

I'm running Mojave (10.14.4) and Version 10.2 of the XCode Command Line Tools, and when running gem install scrypt -v 1.2.1, I was getting the exact same error as described above.

The solution was to install this package: /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg (as described in Can't compile C program on a Mac after upgrade to Mojave). Apparently the root of the issue was that somewhere in this process (bundler? scrypt?) there was an expectation that header files could be found in /usr/include. The latest version of XCode does not place header files in that location, but running the package places them there (as documented in the XCode release notes)


Installing the command line tools for 10.13 fixed this for me.