1nvw-a
Last Updated: February 25, 2016
·
4.39K
· akalyaev
D83b63db79b42978fe35e120550ca180

Switch to your favorite shell in Vagrant

If you are using Vagrant and want to use your favorite shell (I mean zsh of course) inside the box, this is what you need to do:

  1. Install zsh package. If you are using Chef:

    package 'zsh'

Or Puppet:

package { 'zsh':
  ensure => installed
}
  1. Change default shell for vagrant user. If you are using Chef:

    execute "set zsh as default shell" do
      command "chsh -s $(which zsh) vagrant"
    end

Or Puppet:

user { "vagrant":
  ensure => present,
  shell  => "/bin/zsh", # or "/usr/bin/zsh" depending on guest OS (check it by running `which zsh`)
}

Typically it is written in your "work machine" cookbook (or manifest), so you could use it across different projects.

Say Thanks
Respond

4 Responses
Add your response

6212
Ava smile

On Ubuntu, it's usually /usr/bin/zsh

over 1 year ago ·
6213
D83b63db79b42978fe35e120550ca180

@vassilevsky, thanks for spotting this! Updated it.

over 1 year ago ·
17626
5b70c729506eeb6ff1d5b277eeb0f2da

I'm an occasional / first time Chef user. Where exactly, in what file(s), do I add those lines?

over 1 year ago ·
17627
D83b63db79b42978fe35e120550ca180

@dandv for chef it is usually <name_of_your_cookbook>/recipes/default.rb (e.g. workwm/recipes/default.rb)

over 1 year ago ·