Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for macOS awesome terminal
Ran Cohen
Ran Cohen

Posted on • Edited on

     

macOS awesome terminal

Hellodevelopers 🧑‍💻,thanks for reading my post 🙏.

A shell is a user interface foraccess to an operating system’s services. Most often the user interacts with the shell using a command-line interface (CLI). Theterminal 💻 is a program that opens a graphical window and lets youinteract with the shell.

As developers, one of theprograms we use most is our terminal, and as such it should allow us tobe as productive and fast as possible 🚀 as well as to show off its features and pretty look 😎.

So let's embark on a journey 🧭 to make ourterminal in macOS no less awesome 🙌.


iTerm2

iTerm2 logo

Initially, we willreplace thepreinstalled terminal foriTerm2, which hastons of very useful features.

  • Go toiTerm2 download page and downloaded the stable release.
  • After the download is complete, drag the file to the Applications folder.
  • Bonus: Place iTerm2 in a convenient place in the dock (replace the original terminal if you already have it there).

iTerm2has a standalone update mechanism so I prefer toinstall it manually rather than through a brew cask.

Oh My Zsh

Oh My Zsh logo

Next, let'sunleash our terminal byinstallingOh My Zsh.

Oh My Zsh is an open source, community-driven framework for managing your Zsh configuration.

Oh My Zshcomes bundled withplugins that'll make your life as a developer easier and leave youfeeling like a superhero.

To enable a plugin add its name to the plugins array in your.zshrc file (found in the$HOME directory).
Here are some thatI highly recommend:

plugins=(alias-finder brew common-aliases copypath copyfile docker encode64 githistoryjsontools macos web-search z)
Enter fullscreen modeExit fullscreen mode

Wheninstalling Zsh'stheme andplugins, opt foroh-my-zsh installation (... which is actually agit clone of the plugin's repo into the$ZSH_CUSTOM folder and a setting change in.zshrc). It will play best with the other settings in.zshrc, and theautoupdate plugin will keep themup-to-date.

Zsh Theme

My choice of theme for Zsh isPowerlevel10k. Beyond being fast and minimal, it hasmaintained its popularity for many years andcontinues to improve with each new version. Also, I'm totally in favor ofinstalling therecommended font that comes with it.

Zsh plugins

  • autoupdate-zsh-plugin: Auto update git-repositories in $ZSH_CUSTOM folder. This pluginis crucial because itkeeps the rest of the pluginsup-to-date.
  • zsh-syntax-highlighting: It enables highlighting of commands while they’re typed. This helps in reviewing commands before running them, particularly in catching syntax errors.
  • zsh-autosuggestions: It suggests commands as you type based on your history and completions.
  • zsh-history-substring-search: Type in any part of any command from your history, and then press chosen keys, such as the UP and DOWN arrows, to cycle through matches.
  • zsh-nvm: Zsh plugin for installing, updating and loading nvm.nvm installation is relevant for developers working withnode.js. This plugin is recommended sincenvm via brew isn't supported.

iTerm2 Elevation

Toopen the preferences at any stage, Open iTerm2 → Press(command) ⌘ + , (comma).

Shell Integration

Enabling the shell integration featureenables many useful features by itself.
Follow theofficial documentation instructions.
In practice the steps should look something like this:install-shell-integration-1install-shell-integration-2

Key Mappings

Setting thesekey mappings allows us touse common keyboard shortcuts in our terminal.

Follow theinstructions in the gist I made for this purpose, and if you found it helpful, I'd appreciate you giving it a star as well.

Hotkey

Setting ahotkey allows us toshow or hide iterm window even if another application is active.

  • Preferences → Keys → Hotkey → ☑️ Show/hide all windows with a system-wide hotkey
  • Click on the rectangle that appears right to "Hotkey:" → Set your preferred key sequencehotkey-setting

Status Bar

Setting up thestatus bar allows us toget up-to-date information about the environment we're working in.

  • Preferences → Profiles → Session → ☑️ Status bar enabled
  • Click Configure Status Bar button to begin setting up your status bar configuration.My active components are: CPU Utilization, Memory Utilization and Network Throughputmy-status-bar

Remove thelast login: ... line on top of each new window

cd ~;touch .hushlogin
Enter fullscreen modeExit fullscreen mode

Allow iTerm to access administrative files

  • System Preferences → Security & Privacy → Full Disk Access → ☑️ iTerm.app

Use TouchID for sudo execution

  • Open/etc/pam.d/sudo with a text editor as admin
sudovim /etc/pam.d/sudo
Enter fullscreen modeExit fullscreen mode
  • addauth sufficient pam_tid.so lineon top and save/etc/pam.d/sudo
  • Preferences → Advanced → Allow sessions to survive logging out and back → Select "No"

Set some "nice to have" preferences

  • General → Closing → ☑️ Quit when all windows are closed
  • General → Selection → ☑️ Double-click performs smart selection
  • General → Window → ☑️ Smart window placement
  • Appearance → General → Theme → Select "Minimal"
  • Appearance → Tabs → ☑️ Show tab bar even when there is only one tab
  • Profiles → General → Icon (Basics) → Select "Built-in Icon for Current App"
  • Profiles → General → Working Directory → 🔘 Advanced Configuration → Edit... → Working Directory for New Split Panes → 🔘 Reuse previous session's directory
  • Profiles → Text → Cursor → 🔘 Vertical bar + ☑️ Blinking cursor
  • Profiles → Text → Font → Increase size (I use16 as in my IDE)
  • Profiles → Terminal → Shell Integration → ☐ Show mark indicators
  • Keys → Navigation Shortcuts → Shortcut to choose a split pane → Select your preferred option (I use⌥ Number)
  • Pointer → General → ☑️ Focus follows mouse
  • Advanced → Mouse → Scroll wheel sends arrow keys when in alternate screen mode → Select "Yes"

Add a screensaver

  • CMatrix shows text flying in and out in a terminal like as seen in "The Matrix" movie.
brewinstallcmatrixcmatrix
Enter fullscreen modeExit fullscreen mode
brewinstallpipes-shpipes-sh
Enter fullscreen modeExit fullscreen mode

Install useful command-line tools

GitHub logo agarrharr / awesome-cli-apps

🖥 📊 🕹 🛠 A curated list of command line apps


The Result ✨

configuration files (.zshrc, iterm-profile.json etc..) as a gist

result

Top comments(2)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
kushagrarora17 profile image
Kushagr Arora
I like to code and listen to audiobooks. On weekends, I turn into an improviser.
  • Location
    Karnal, India
  • Education
    Guru Gobind Singh Indraprastha University
  • Work
    Software Engineer
  • Joined

Great post!
Please consider updating plugins as I received this message after installation:
Thecopydirplugin is deprecated. Use thecopypathplugin instead.

CollapseExpand
 
rannn505 profile image
Ran Cohen
https://www.linkedin.com/in/rannn505/

Done. Thanks for catching that 🙏🏼.

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

https://www.linkedin.com/in/rannn505/
  • Work
    CTO & Co-Founder at Configu
  • Joined

More fromRan Cohen

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp