July 8, 2019

Installing oh-my-zsh on Raspberry Pi

How to install oh-my-zsh on Rasbian Buster and a few useful plugins to get started

Installing oh-my-zsh on Raspberry Pi

Why ZSH?

oh my zsh is wonderful, and really makes the rest of life better when ssh-ing into your Raspberry Pi.

How do I explain it... bash is to zsh as a regular, original unconfigured vi is to a nicely configured modern vim.

To put it in MIB venacular, bash isn't "old and busted" - but zsh is definitely the new hotness.

All I can say, is if you haven't tried it - it's difficult to explain just how much better life is with ZSH than without it.

Those who have tried it know exactly what I'm talking about - so I'll shutup and get to how to make it happen quickly.

It's actually quite simple and straight forward.


Okay, so this is actually really easy. You're doing three things.

  1. Making sure the latest version of zsh is installed
  2. Installing oh-my-zsh
  3. Installing and tweaking a few plugins

How to install oh-my-zsh

Install zsh

1. Update your Raspberry Pi

... if you haven't recently (like... within the last hour or so, even then it's probably still a good idea.)

sudo apt-get update && sudo apt-get upgrade
sudo apt-get update && sudo apt-get upgrade
Hit:1 http://raspbian.raspberrypi.org/raspbian buster InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

2. Install git and zsh

sudo apt-get install git zsh

(To Answer "Yes" when it asks, hit enter... I always type the answer I want, I don't know why.)

sudo apt-get install git zsh
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  git-man libcurl3-gnutls liberror-perl zsh-common
Suggested packages:
  git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-cvs git-mediawiki git-svn zsh-doc
The following NEW packages will be installed:
  git git-man libcurl3-gnutls liberror-perl zsh zsh-common
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 10.7 MB of archives.
After this operation, 49.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirror.us.leaseweb.net/raspbian/raspbian buster/main armhf libcurl3-gnutls armhf 7.64.0-4 [291 kB]
Get:2 http://mirror.us.leaseweb.net/raspbian/raspbian buster/main armhf liberror-perl all 0.17027-2 [30.9 kB]
Get:3 http://mirror.us.leaseweb.net/raspbian/raspbian buster/main armhf git-man all 1:2.20.1-2 [1,619 kB]
Get:4 http://mirror.us.leaseweb.net/raspbian/raspbian buster/main armhf git armhf 1:2.20.1-2 [4,202 kB]
Get:5 http://mirror.us.leaseweb.net/raspbian/raspbian buster/main armhf zsh-common all 5.7.1-1 [3,804 kB]
Get:6 http://mirror.us.leaseweb.net/raspbian/raspbian buster/main armhf zsh armhf 5.7.1-1 [746 kB]
Fetched 10.7 MB in 5s (2,347 kB/s)
Selecting previously unselected package libcurl3-gnutls:armhf.
(Reading database ... 37607 files and directories currently installed.)
Preparing to unpack .../0-libcurl3-gnutls_7.64.0-4_armhf.deb ...
Unpacking libcurl3-gnutls:armhf (7.64.0-4) ...
Selecting previously unselected package liberror-perl.
Preparing to unpack .../1-liberror-perl_0.17027-2_all.deb ...
Unpacking liberror-perl (0.17027-2) ...
Selecting previously unselected package git-man.
Preparing to unpack .../2-git-man_1%3a2.20.1-2_all.deb ...
Unpacking git-man (1:2.20.1-2) ...
Selecting previously unselected package git.
Preparing to unpack .../3-git_1%3a2.20.1-2_armhf.deb ...
Unpacking git (1:2.20.1-2) ...
Selecting previously unselected package zsh-common.
Preparing to unpack .../4-zsh-common_5.7.1-1_all.deb ...
Unpacking zsh-common (5.7.1-1) ...
Selecting previously unselected package zsh.
Preparing to unpack .../5-zsh_5.7.1-1_armhf.deb ...
Unpacking zsh (5.7.1-1) ...
Setting up zsh-common (5.7.1-1) ...
Setting up libcurl3-gnutls:armhf (7.64.0-4) ...
Setting up liberror-perl (0.17027-2) ...
Setting up git-man (1:2.20.1-2) ...
Setting up zsh (5.7.1-1) ...
Setting up git (1:2.20.1-2) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libc-bin (2.28-10+rpi1) ...

3. Make zsh your default shell

chsh -s /bin/zsh
chsh -s /bin/zsh

It will ask for your password... type it in.

Okay, we're close, but we're not done yet. You have zsh sure... but oh-my-zsh is basically a package manager for a bunch of super great improvements and basic zsh configuration.

If you were to log out and log back in right at this particular moment, you will see something like this:

This is the Z Shell configuration function for new users,
You are seeing this message because you have no zsh startup files
(the files .zshenv, .zprofile, .zshrc, .zlogin in the directory
~).  This function can help you with a few settings that should
make your use of the shell easier.

You can:

(q)  Quit and do nothing.  The function will be run again next time.

(0)  Exit, creating the file ~/.zshrc containing just a comment.
     That will prevent this function being run again.

(1)  Continue to the main menu.

(2)  Populate your ~/.zshrc with the configuration recommended
     by the system administrator and exit (you will need to edit
     the file by hand, if so desired).

--- Type one of the keys in parentheses ---

If you do, just type q and hit enter.

When you install oh-my-zsh it will configure your zsh for you. So let's do that now.

4. Install oh-my-zsh

Feel free to check out the installation line at -> https://github.com/robbyrussell/oh-my-zsh we're just use the curl method to install oh-my-zsh.

Here's the install line as of today:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Cloning Oh My Zsh...
Cloning into '/home/jeremy/.oh-my-zsh'...
remote: Enumerating objects: 1048, done.
remote: Counting objects: 100% (1048/1048), done.
remote: Compressing objects: 100% (966/966), done.
remote: Total 1048 (delta 23), reused 835 (delta 19), pack-reused 0
Receiving objects: 100% (1048/1048), 694.63 KiB | 774.00 KiB/s, done.
Resolving deltas: 100% (23/23), done.

Looking for an existing zsh config...
Using the Oh My Zsh template file and adding it to ~/.zshrc.

         __                                     __
  ____  / /_     ____ ___  __  __   ____  _____/ /_
 / __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \
/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / /
\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/
                        /____/                       ....is now installed!

Please look over the ~/.zshrc file to select plugins, themes, and options.

p.s. Follow us on https://twitter.com/ohmyzsh

p.p.s. Get stickers, shirts, and coffee mugs at https://shop.planetargon.com/collections/oh-my-zsh

... Congratulations! and Welcome to the New Hotness!

We're almost done. Just a few plugins to get you started and you're off to the races.

Install and tweak a few plugins

Okay, so most guides on how to do this stop here... but I'm cooler than them - so I'm going to show you what oh-my-zsh is all about and give you a few oh-my-zsh plugins that are really worth having.

  1. zsh-syntax-highlighting
  2. zsh-autosuggestions
  3. zsh-completions

TODO: clean up the installation instructions for all three of these plugins - and a few tweaks for zsh-syntax-highlighting.

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

Cloning into '/home/jeremy/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting'...
remote: Enumerating objects: 19, done.
remote: Counting objects: 100% (19/19), done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 5408 (delta 9), reused 17 (delta 8), pack-reused 5389
Receiving objects: 100% (5408/5408), 1.11 MiB | 822.00 KiB/s, done.
Resolving deltas: 100% (3580/3580), done.
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

Cloning into '/home/jeremy/.oh-my-zsh/custom/plugins/zsh-autosuggestions'...
remote: Enumerating objects: 78, done.
remote: Counting objects: 100% (78/78), done.
remote: Compressing objects: 100% (42/42), done.
remote: Total 2249 (delta 37), reused 67 (delta 33), pack-reused 2171
Receiving objects: 100% (2249/2249), 519.94 KiB | 820.00 KiB/s, done.
Resolving deltas: 100% (1422/1422), done.
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions

Cloning into '/home/jeremy/.oh-my-zsh/custom/plugins/zsh-completions'...
remote: Enumerating objects: 4073, done.
remote: Total 4073 (delta 0), reused 0 (delta 0), pack-reused 4073
Receiving objects: 100% (4073/4073), 1.48 MiB | 890.00 KiB/s, done.
Resolving deltas: 100% (2536/2536), done.

Open ~/.zshrc in your favorite editor

vi .zshrc

Uncomment the 2nd line where it sets your path.

# export PATH=$HOME/bin:/usr/local/bin:$PATH


export PATH=$HOME/bin:/usr/local/bin:$PATH

And replace the line that says


With this:

plugins=(git zsh-completions zsh-autosuggestions zsh-syntax-highlighting)
autoload -U compinit && compinit

Now quit vim :wq then hit enter

Now logout.


(you may have to type exit again)

uberbuilder% exit
Connection to uberbuilder.local closed.

Now login again to your Pi, and you're done!


Now, welcome to your super new and improved zsh shell.

... your welcome :)