Oh My Zsh For Mac
Please follow me on Twitter for updates.
Ultimate way to beautify Mac terminal (oh-my-zsh) and plugin recommendations. If you are using Mac as development machine,. Mac安装zsh和oh my zsh, 安装brew, 安装zsh, 安装oh my zsh, 切换shell, 更换主题& &安装插件 Toggle navigation Vien Blog 搬瓦工优惠码 友链申请 打赏支持 Mac安装zsh和oh my zsh 2019-02-16 08:05:38.
I was a long-time Windows user, a fairly happy one, but as a developer, there were a lot of things that were missing for me and one of the main was the terminal experience. I’m not a fan of the closed ecosystem of Apple so Linux was an easy choice for me and I switched to Linux almost 3 years ago. I did start out with Ubuntu and later switched to Fedora which is my primary OS now. You can read about my setup here
As a senior developer and open source community lead, I spent a lot of time on the terminal and a terminal with a nice developer experience instantly makes you happier and more productive. The default bash terminal is good for beginners but if you really want a powerful terminal you need something more than bash.
Let’s see how to configure a powerful and productive terminal experience. The setup is based on what I have configured on my Fedora machine. The same setup can be recreated on any other Linux distribution, BSD or Mac as well. You just need to use the installation instruction from the tools for the given platform.
Below are the tools we would need for this.
Zsh
Zsh is one of the most feature-rich shells for Unix. It works on Linux, Mac, WSL, and BSD. There are alternatives like Fish which also offers similar features but I personally like Zsh.
- Check if Zsh is already installed by running
zsh --version
on your terminal. If not found, install it using your package manager.- Fedora:
sudo dnf install zsh
- Mac:
brew install zsh zsh-completions
- RHEL/CentOS:
sudo yum update && sudo yum -y install zsh
- Ubuntu/Debian:
sudo apt install zsh
- For other platform refer this
- Fedora:
- Now make Zsh your default shell by running
chsh -s $(which zsh)
. - Log out and log in back again to use your new default shell.
- Test that it worked with echo
$SHELL
. Expected result:/bin/zsh
or similar. - Test with
$SHELL --version
. Expected result:zsh 5.6.2
or similar
Note: If you have installed Zsh for the first time and launch the shell it would prompt you to configure some settings. You can choose to ignore that by hitting q
as we will configure it later on.
Oh-My-Zsh
Oh-My-Zsh gives the Zsh shell superpowers. Its a framework to manage Zsh configuration. It has plugins and themes for Zsh(A lot of them).
From their Github page:
Once installed, your terminal shell will become the talk of the town or your money back! With each keystroke in your command prompt, you’ll take advantage of the hundreds of powerful plugins and beautiful themes. Strangers will come up to you in cafés and ask you, “that is amazing! are you some sort of genius?”
Just install it. You need it :)
Terminal emulator/multiplexer
Optionally you can use a Terminal emulator that can manage windows and panes for you.
For Linux I would recommend using Tilix, I have been using it for 3 years and its just amazing.
For Mac, you can use iTerm2 which is very popular.
Alternatively, you can also use tmux if you want something lighter on your existing Terminal app on Linux, BSD or Mac.
Configuring Zsh
This is the fun part. Let us make the terminal awesome.
Install plugins
First, let us install some additional plugins that are not bundled with Oh-My-Zsh.
zsh-autosuggestions
Provides auto completion for shell commands.
Run git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
to install
zsh-syntax-highlighting
Provides syntax highlighting on the shell.
Run git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
to install
autojump
Provides a smarter directory navigation system. Install autojump for your OS following instructions here.
Now let us configure the ~/.zshrc
file with some settings. Here is my full .zshrc
file. Your mileage may vary.
Add exports
We will start with some exports.
Zsh settings
Now we can configure some Zsh specific settings
Zsh theme
Now, Let’s set up a nice theme. I’m using powerlevel10k as my current theme and it’s fast and looks great. You can use the default or you can choose any theme you like from the list here. If you like my theme then follow these instructions. Thanks to Roman Perepelitsa for some cool tips
Run git clone https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k
to install the theme.
Install a Powerline font. I use Adobe Source Code Pro
Add the below configuration to the ~/.zshrc
file.
Enable plugins
We can finish off by enabling the plugins and some tweaks
And that’s it we are ready. Start a new terminal session and enjoy.
Issues & workarounds
If you use Tilix as your terminal emulator, then this might be required for proper pane splitting. Add this to your ~/.zshrc
If you are getting errors from the zsh-completion plugin, you might want to add this to the beginning of your ~/.zshrc
If you encounter an error from Oh-My-Zsh saying [oh-my-zsh] Insecure completion-dependent directories detected
, set ZSH_DISABLE_COMPFIX=true
right before the line source $ZSH/oh-my-zsh.sh
in your ~/.zshrc
file and restart your session or run exec zsh
Bondan Prakoso & Fade 2 Black RIP (Rhyme In Peace) Chord Intro Am Em F C (2x) Rap Am Apa kata yang tepat untuk protes terhadap waktu Em Rhyme style apa yang pas untuk demo sedih diriku F Air mataku sanggup katakan lebih banyak dari C pada pesan yang disampaikan semua kata Am yo yo capital A. Double much respect for ya Em Kau Selalu karyakan beat untuk rima ber-lima F Meski jarak. Lirik Lagu & Kunci Gitar / Chord Steven & Coconut Treez - Selamat Jalan Kawan G dan harus kuakui Bm aku kehilangan Am7 ku kehilangan saat bersama C Cm saat kita pernah berbagi rasa G tak bisa kupungkiri Bm aku kehilangan Am7 ku kehilangan keseimbangan C Cm perih yang tak tertahankan Bm Em aku tak berdaya yee. Selamat jalan kawan cepatlah berlabuh Dm Am.mimpimu kini tlah kau dapati C G F.tak ada lagi seorangpun yang mengganggu. G Kau bernyanyi. C G Semoga dalam damaimu kau mengerti Dm Am.arti gelapnya jalan yang kau daki C G.hingga indahnya bias mentari. Chord R.I.P (Rhyme In Peace) - Bondan Prakoso & Fade 2 Black. Reff: Am Em.Hari hari yang kan ku jalani F C Kini semua kan terasa sunyi. Am Em.Walau hampa. Bondan Selamat Jalan Kawan; Bondan Selamat Jalan Kawan. Lirik Lagu dan Kunci Gitar / Kord / Chord Bondan. Selamat jalan Am Em F C selamat. King arthur untuk kau kawan C Kami minum. Kawan yang tepat untuk sharing hal-hal kecil. Selamat jalan kami detik ini tanpa. Syair, ringtone, download MP3, kord kunci gitar.
Dockerized playground.
If you have Docker installed then you can use the below snippet to try this setup in a sandbox without installing anything or affecting your existing setup.
VSCode Tip
If you are using VSCode like me, you might want to do the below to get the same terminal experience in the integrated VSCode terminal as well.
Follow these steps
- Download and install a patched font.
- On Linux, run
fc-cache -f -v
to refresh font cache. - On VSCode, open Preferences → Settings and click on the
{}
icon to open JSON mode and set the belowReplace
linux
withosx
if you are on a Mac.
I hope you like it. If you have any questions or if you think I missed something please add a comment.
If you like this article, please leave a like or a comment.
You can follow me on Twitter and LinkedIn.
Also published on Dev.to