Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/env ruby
# get memory in kilobytes and store it
output = %x(free)
min_ram = 8388608
# grab the total column and store it
free_ram = output.split(" ")[7].to_i
# define error message if less than 8 GB of ram
MEM_SIZE = "This system has less than 8 GB of total memory. Please have at least 8 GB of total ram free before running the installer."
# define our error message method to write to stderr and exit
def error_exit(message, code)
$stderr.puts message
exit code
# provide our error to the user if ram is less than 8 GB
error_exit(MEM_SIZE, 1) if output < min_ram
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.