When run vagrant provision, instead of install the ruby gems in user environment, install in the root user environment.
Here is my vagrant file:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "scotch/box"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.hostname = "scotchbox"
config.vm.synced_folder ".", "/var/www", :mount_options => ["dmode=777", "fmode=666"]
# Optional NFS. Make sure to remove other synced_folder line too
#config.vm.synced_folder ".", "/var/www", :nfs => { :mount_options => ["dmode=777","fmode=666"] }
config.vm.provision "shell", path: "provision/install.sh"
config.vm.provision "shell", path: "provision/install-gems.sh"
end
And the install-gems.sh:
#!/usr/bin/env bash
echo "- install sass ..."
gem install sass
echo "- install sass done"
echo "- install compass ..."
gem install compass
echo "- install compass done"
echo "- install bootstrap-sass ..."
gem install bootstrap-sass
echo "- install bootstrap-sass done"
When i run gem list
, the gems not appears, but when i run sudo gem list
, they do, which i don't want to.
How can i in vagrant install the gems in not root mode? Try to add the privileged: false
in vagant file, but not work because of privileges.
Thanks!