-
-
Save duggan/5773356 to your computer and use it in GitHub Desktop.
Vagrant (v1.1+) snippet to set VirtualBox guest CPU count to the number of host cores on Linux or OS X
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
if not RUBY_PLATFORM.downcase.include?("mswin") | |
config.vm.provider "virtualbox" do |v| | |
v.customize ["modifyvm", :id, "--cpus", | |
`awk "/^processor/ {++n} END {print n}" /proc/cpuinfo 2> /dev/null || sh -c 'sysctl hw.logicalcpu 2> /dev/null || echo ": 2"' | awk \'{print \$2}\' | cut -d' ' -f2 `.chomp ] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment