byte_code = RubyVM::InstructionSequence.compile_file('/home/henry/somefile.rb') File.binwrite('/home/henry/bytecode', byte_code.to_binary)