Browse Source

Give VirtualBox access to all host CPU cores

via https://stefanwrobel.com/how-to-make-vagrant-performance-not-suck
release/0.21
Gareth Rees 7 years ago
parent
commit
ace94c0df3
  1. 11
      Vagrantfile

11
Vagrantfile

@ -97,7 +97,18 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# The bundle install fails unless you have quite a large amount of
# memory; insist on 1.5GiB:
config.vm.provider "virtualbox" do |vb|
host = RbConfig::CONFIG['host_os']
# Give VM access to all cpu cores on the host
if host =~ /darwin/
cpus = `sysctl -n hw.ncpu`.to_i
elsif host =~ /linux/
cpus = `nproc`.to_i
else # sorry Windows folks, I can't help you
cpus = 1
end
vb.customize ["modifyvm", :id, "--memory", ALAVETELI_MEMORY]
vb.customize ["modifyvm", :id, "--cpus", cpus]
end
# Fetch and run the install script:

Loading…
Cancel
Save