Version information
ruby 2.5.0
mac 10.13.6 high sierra

I knew that I could convert rb to an exe for windows with ruby.

I am planning to use ocra for exe.

gem install ocra


puts "aaaa"

Because it is a test, an application that only displays aaaa

ocra test.rb

Error details after execution

/Users/hogehoge/.rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require ': cannot load such file-Win32API (LoadError)

An error occurs in Win32API.

Check gem list but there is no win32api, so if you think that is the cause and search with gem win32api
win32-api 1.7.1-universal-mingw32 This will cause an error even if it is installed.

Specify version

gem install win32-api 1.7.1-universal-mingw32

↓ Error details
ERROR: Could not find a valid gem'win32-api'(= 1.7.1) in any repository
ERROR: Possible alternatives: win32-api

Nothing specified next

gem install win32-api

↓ Error details
Permission denied @ rb_sysopen-/Users/hogehoge.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/win32-api-1.4.8/CHANGES

Because you have permission, running with sudo will result in an error.

Error details

current directory: /Users/hogehoge/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/win32-api-1.4.8/ext
make "DESTDIR ="
compiling win32/api.c
win32/api.c: 2: 10: fatal error: 'windows.h' file not found
         ^ ~~~~~~~~~~
1 error generated.
make: *** [api.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/hogehoge/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/win32-api-1.4.8 for inspection.

Can't find'windows.h&apos ;?

Win32api is not displayed in the gem list, but there is a win32-api in the gems and it causes confusion.

I would appreciate it if you could check the solution or here.