Last Updated: February 25, 2016
· akalyaev

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"

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.

4 Responses
Add your response

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

over 1 year ago ·

@vassilevsky, thanks for spotting this! Updated it.

over 1 year ago ·

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

over 1 year ago ·

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

over 1 year ago ·