Install and configure iTerm2

  1. Download iTerm2 from https://www.iterm2.com/downloads.html
  2. Double click the downloaded ZIP file to extract the application,
  3. Move the iTerm application to Applications.

iTerm2 configuration

Use .bashrc for configuration

When you start iTerm, it reads its own config file, ~/.zshrc To keep using the standard ~/.bashrc config file

  • Create the ~/.zshrc file and have only one line in it:source ~/.bashrc

Set case-insensitive tab completion

Add these lines to the ~/.zshrc file

# Set case insensitive comparison when lower case letters are typed.
# Upper case typed letters only match upper case file names
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
autoload -Uz compinit && compinit

Enable unlimited scroll back

  1. Start iTerm2 and open the preferences window by pressing ⌘, (command-comma)
  2. On the Profiles, Terminal tab click the Unlimited scrollback check box.

Set the highlight color

By default the highlighted text just a little different from the rest. When we search for something, it is hard to notice the found text.

To change the highlighted text color

  1. Start iTerm
  2. In the iTemr2 menu select Preferences…
  3. On the Profiles, Colors tab set the color of the Selection and Selected Text
     

Start iTerm2 from Finder

To be able to open iTerm2 in any folder from Finder follow the steps below based on https://gist.github.com/shuntaroy/e5ce3ad61c0deb7e27f0

  1. Start Automator,
  2. Select Quick Action and click Choose,
  3. On the top of the screen set Workflow receives selected to files and folders,
  4. Set in to Finder,
  5. On the second side bar from the left double click Run AppleScript to open the editor window,
  6. Paste the code from the website referenced above into the editor window replacing the sample script in the editor window,
  7. In the File menu save the script,
  8. Do not run it, it does not execute in the Automator.

To use it

  1. Open Finder and navigate to the location you want to work in,
  2. Right click a folder to work in that folder or a file to work in the current folder
  3. Select ServicesiTerm2 in Finder
 

“Solarized” color scheme

  1. Download the color scheme to the Desktop with the following Bash command:curl -o ~/Desktop/solarized.itermcolors https://raw.githubusercontent.com/altercation/solarized/master/iterm2-colors-solarized/Solarized%20Dark.itermcolors
  2. Import the color scheme to iTerm2
    • Press ⌘, (command-comma) to open the Preferences window
    • Select Profiles
    • In the lower right corner of the Colors tab click the Color Presets… drop down
    • Select Import
    • On the Desktop select the downloaded solarized.itermcolors file
    • In the  Color Presets… drop down select Solarized Dark

 Meslo Powerline font

  • Import the Meslo Powerline font with the following bash command:git clone https://github.com/powerline/fonts.git && cd fonts && ./install.sh
  • Select the font in iTerm2
    • Press ⌘, (command-comma) to open the Preferences window
    • Select Profiles
    • On the Font section of the Text tab click the Change Font button
    • Select the 12pt Meslo LG L Regular for Powerline

Make the prompt shorter

to remove your username@computername from the prompt

  • Edit the ~/.bashrc file
  • Add the following lineDEFAULT_USER=”YOUR_USER_NAME”

Colored prompt

To color the prompt:

  • Download the agnoster theme
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
  • Edit the ~/.bashrc file and set the ZSH_THEME to ZSH_THEME=”agnoster”

More configuration suggestions are at

https://ruigomes.me/blog/perfect-iterm-osx-terminal-installation/
https://gist.github.com/kevin-smets/8568070

Information on how terminals read settings at https://shreevatsa.wordpress.com/2008/03/30/zshbash-startup-files-loading-order-bashrc-zshrc-etc/

Leave a comment

Leave a Reply