DEV Community

Cover image for Improved Shell (MacOS)
Maxime HEBRARD
Maxime HEBRARD

Posted on • Updated on

Improved Shell (MacOS)

MacOS comes with a default terminal, but it might be convenient to customized it to improve user experience.

Homebrew

Homebrew is a package manager for MacOS, we will use it to install all the software on Mac.

  • Open the web browser
  • Visite homebrew
  • Follow install instructions...
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Enter fullscreen mode Exit fullscreen mode
  • Proceed with installation
  • Follow instructions to add homebrew to your PATH
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/hebrardms/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
Enter fullscreen mode Exit fullscreen mode

To install software using homebrew:

  • Open the web browser
  • Visite homebrew
  • Search for the software
  • Copy the recipe
  • Open 'Terminal'
  • Paste the recipe and run the command.
  • Follow installation instructions...

Git

Git is a version control software. It is also wildely use to distribure software.

  • Open 'Terminal'
  • Install git from homebrew
brew install git
Enter fullscreen mode Exit fullscreen mode
  • Check git version
git --version
# git version 2.30.1 (Apple Git-130)
Enter fullscreen mode Exit fullscreen mode

Fonts

We will change the default font of the terminal in preparation for the theme we will install later.

  • Open the web browser
  • Visit powerlevel10K - Fonts
  • Install the recommended fonts (MenloLGS)
    • Download the font files from the github links
    • Open Font Book
    • Click on '+' icon
    • Select the MesloLGS files
    • Click 'Open'

Color theme

Default terminal colors can be inappropriate. They do not play well with the theme we will install later.

  • Open the web browser
  • Visit tomorrow theme
  • Download the theme for 'OS X Terminal'
  • Open 'Terminal'
  • Navigate to the menu 'Terminal / Preferences...'
  • Navigate to the tab 'Profiles'
  • Below the list of profiles, click on '...'
  • Select 'Import...'
  • Select Tomorrow Night.terminal file
  • Click on 'Open'
  • In the list of profiles, select 'Tomorrow Night'
  • Click on 'Default'
  • Change font to 'Menlo LGS NF'

Oh My Zsh

MacOS come with a minimal terminal. In this section, we will configure the terminal to add some features and style using Oh My ZSH and the theme Powerlevel10k.

  • Open the web browser
  • Visite Oh My Zsh
  • Follow Install instructions...
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Enter fullscreen mode Exit fullscreen mode

OMZ

Powerlevel10K

Theme that add useful infomation right in the prompt.

  • Open the web browser
  • Visite powerlevel10k
  • Follow Powerlevel install instructions...
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Enter fullscreen mode Exit fullscreen mode
  • Install zsh-autosuggestions plugin that provides autocompletion based on our previous commands
git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
Enter fullscreen mode Exit fullscreen mode
  • Install exa a modern replacement for ls.
brew install exa
Enter fullscreen mode Exit fullscreen mode
  • Edit .zshrc to enable powerlevel theme
vim .zshrc
Enter fullscreen mode Exit fullscreen mode
  • Press 'i' to enter insert mode
  • Uncomment options and edit file as follow...
# ZSH_THEME="robbyrussell"
ZSH_THEME="powerlevel10k/powerlevel10k"

DISABLE_MAGIC_FUNCTIONS="true"

DISABLE_LS_COLORS="true"

ENABLE_CORRECTION="true"

COMPLETION_WAITING_DOTS="true"

DISABLE_UNTRACKED_FILES_DIRTY="true"

plugins=(git zsh-autosuggestions)

# Alias of ls using exa
if [ -x "$(command -v exa)" ]; then
    alias ls="exa --icons"
    alias ll="exa --icons --long"
    alias la="exa --icons --long --all --group"
    alias lt="exa --icons --long --all --group --git --tree"
fi
Enter fullscreen mode Exit fullscreen mode
  • Press 'esc' to exit insert mode
  • Press ':' and 'x' end 'return' to save and quit the file
  • Update Terminal
source .zshrc
Enter fullscreen mode Exit fullscreen mode
  • Follow instructions to customise the prompt

EXA

Check Config

  • Install neofetch from homebrew
brew install neofetch
Enter fullscreen mode Exit fullscreen mode
  • Check config
neofetch
Enter fullscreen mode Exit fullscreen mode

fetch

Next, I suggest you follow Environment Manager - Conda.

Top comments (3)

Collapse
 
moopet profile image
Ben Sinclair

Oh My Zsh is an alternative to the default shell

I'm being picky, perhaps, but Oh My Zsh isn't a shell, zsh is... and zsh has been the default shell on Macs for a while because Apple doesn't want to use copyleft software.

I bring this up because there are a ton of articles which say the same thing, and it's misleading for new users, who are already going to be confused between the terminal, the shell, the command prompt, etc.

Collapse
 
mhebrard profile image
Maxime HEBRARD

Point taken. I edited the sentence for

"Oh My Zsh is a framework to manage the configuration of the shell and come with a collection of themes."

Hope that rectify the message.

Thanks for the feedback. Always open to suggestion for improvement

Collapse
 
sso profile image
Info Comment hidden by post author - thread only accessible via permalink
Sall

🥷 🧙‍‍♀️ wiki.zshell.dev 🧙‍‍♀️ 🥷

Some comments have been hidden by the post's author - find out more