0

I have successfully installed homestead on my mac machine and i have set path using following command

export PATH=~/.composer/vendor/bin:$PATH

but every time when i restart my machine, homestead command does not work, i would have to run export PATH=~/.composer/vendor/bin:$PATH again to fix this.

Please suggest a way to fix this. Thanks for your help.

seoppc
  • 2,766
  • 7
  • 44
  • 76
  • Possible duplicate of [How to permanently set $PATH on Linux/Unix?](https://stackoverflow.com/questions/14637979/how-to-permanently-set-path-on-linux-unix) – Cristik Feb 07 '19 at 17:08

1 Answers1

0

Use a shell provisioner to put that line either in /etc/profile (for the whole system) or just ~vagrant/.profile (for just your user). Like so:

config.vm.provision "set-path", type: "shell" do |s|
    s.inline = "grep "~/.composer/vendor/bin" ~vagrant/.profile &> /dev/null || echo "export PATH=~/.composer/vendor/bin:\$PATH" >> ~vagrant/.profile"
end

This does a grep to check to see if that text is in the file, and if that returns a non-zero result (||) appends that line to the end of the file.

Nathan Hoover
  • 636
  • 3
  • 5