pho ramen soba

Saturday, 30 December 2023

enabling powerline status with iterm on macos 14.2.1

Site logo image whbeebe posted: " Unlike many, I do not move all my macOS settings from machine to machine unless the new machine is a complete replacement for the old machine and the old machine is on its last legs. I've done that exactly once, from my 2015 MBP to the 2019 MBP. After" Arcane Science Lab

enabling powerline status with iterm on macos 14.2.1

whbeebe

Dec 30

Unlike many, I do not move all my macOS settings from machine to machine unless the new machine is a complete replacement for the old machine and the old machine is on its last legs. I've done that exactly once, from my 2015 MBP to the 2019 MBP. After that transfer I spent a fair amount of time weeding out items that did not make sense on the new machine as well as items that were a good idea at the time, but time later proved to be a bad choice.

I made the decision after that one full transfer between MBPs to carefully curate all software before installing anything on the new machine. One of the choices I tried on the older MBP was Powerline. It didn't work, and I almost skipped it entirely on the new MBP, but I decided to install it anyway and try once more to make it work.

I've been using Powerline on my Linux systems for some number of years now. I like what it does and how it looks and I try to install it anywhere I have a terminal and a command line prompt. It's a bit counter-intuitive to want to have a sophisticated command line and terminal on a computer with a graphical user interface, but I keep a terminal environment active because I have decades of CLI experience that has served me admirably (once I was properly trained on how to use it). This post documents how I finally figured it out and what I did to get it to work. And it does work, both on the command line as well as within vi/vim.

Initial Environment

This machine has the following pre-installed:

  • macOS 14.2.1 Sonoma
  • zsh 5.9 (x86_64-apple-darwin23.0)
  • python 3.9.6

This is all you really need to get started. A lot of how-tos (all of them old to very old) insist you install brew, and then via brew install zsh. The version of zsh Apple currently uses is the latest stable release, a far cry from the ancient version of bash it used to use.

Installation

Installation needs three main pieces; iTerm2, the Nerd Hack font and the Powerline status software itself.

iTerm2 can be downloaded from here: https://iterm2.com. Once downloaded, unzip the downloaded file and start the binary. Once running, iTerm2 will pick up and use zsh and it will automagically ask you if you want to move iTerm2 into the Application folder of you Mac. Select yes when asked. From that point iTerm2 can be selected via Launchpad, and once launched, you can right click the resultant icon in the Dock and chose to have it stay in the Dock (right click | Options | Keep in Dock).

The font I installed is Hack and can be found here: https://github.com/ryanoasis/nerd-fonts/releases. Download Hack.zip and unzip it, then use Apple's Font Book utility to install the fonts.

Not all of them will install due to issues with certain fonts, and rather than hassle with trying to resolve those issues I chose to skip them. Skipping the problematic fonts still allowed the fonts I needed to get installed, so no problems there.

Once the fonts are installed, open iTerm2's Preferences and go to Profiles.

Select Hack NF as the Font, Regular weight. I chose to use a 15 point font size because the size of the 16" display makes reading 15 point text in iTerm2 very easy. Even at 15 points a lot of text can still be seen in the terminal window.

With the terminal and font set up, install the Python package powerline-status using pip: pip3 install powerline-status.

Once installed execute the following command:

  $ pip3 show powerline-status                                                                                                          Name: powerline-status  Version: 2.7  Summary: The ultimate statusline/prompt utility.  Home-page: https://github.com/powerline/powerline  Author: Kim Silkebaekken  Author-email: kim.silkebaekken+vim@gmail.com  License: MIT  Location: /Users/wbeebe/Library/Python/3.9/lib/python/site-packages  Requires:  Required-by:  

The line we're interested in is the Location at line 9 in the listing. In this example, because I'm not running as root, the package is installed locally in my home directory, which it should be. Every home directory has a $HOME/Library directory. It's underneath site-packages that you'll find the site package for powerline. Here's what we are looking for specifically:

  $ ls -AlFh Library/Python/3.9/lib/python/site-packages/powerline/bindings  total 24  -rw-r--r--   1 wbeebe  staff     0B Dec 29 15:32 __init__.py  drwxr-xr-x   3 wbeebe  staff    96B Dec 29 17:03 __pycache__/  drwxr-xr-x   4 wbeebe  staff   128B Dec 29 15:32 awesome/  drwxr-xr-x   3 wbeebe  staff    96B Dec 29 15:32 bar/  drwxr-xr-x   3 wbeebe  staff    96B Dec 29 15:32 bash/  -rw-r--r--   1 wbeebe  staff   9.8K Dec 29 15:32 config.py  drwxr-xr-x   3 wbeebe  staff    96B Dec 29 15:32 fish/  drwxr-xr-x   3 wbeebe  staff    96B Dec 29 15:32 i3/  drwxr-xr-x   6 wbeebe  staff   192B Dec 29 15:32 ipython/  drwxr-xr-x   3 wbeebe  staff    96B Dec 29 15:32 lemonbar/  drwxr-xr-x   4 wbeebe  staff   128B Dec 29 15:32 pdb/  drwxr-xr-x   4 wbeebe  staff   128B Dec 29 15:32 qtile/  drwxr-xr-x   3 wbeebe  staff    96B Dec 29 15:32 rc/  drwxr-xr-x   3 wbeebe  staff    96B Dec 29 15:32 shell/  drwxr-xr-x   3 wbeebe  staff    96B Dec 29 15:32 tcsh/  drwxr-xr-x  11 wbeebe  staff   352B Dec 29 15:32 tmux/  drwxr-xr-x   6 wbeebe  staff   192B Dec 29 17:03 vim/  drwxr-xr-x   4 wbeebe  staff   128B Dec 29 15:32 wm/  drwxr-xr-x   4 wbeebe  staff   128B Dec 29 15:32 zsh/  

The two folders we're interested in are line 19 (vim) and line 21 (zsh). Since we're interested in zsh, let's concentrate on that for the moment.

Underneath the zsh folder is one file we need:

  ls -AlFh Library/Python/3.9/lib/python/site-packages/powerline/bindings/zsh  total 32  -rw-r--r--  1 wbeebe  staff   5.4K Dec 29 15:32 __init__.py  -rw-r--r--  1 wbeebe  staff   6.5K Dec 29 15:32 powerline.zsh  

The file powerline.zsh is sourced inside the .zshrc file. But before we add this to our powerline.zsh file, we need to make one more change for the powerline script to execute. At the same level as the lib (library) folder is a bin (binary) folder. Here's what that folder holds:

  $ ls -AlFh Library/Python/3.9/bin  total 160  -rwxr-xr-x  1 wbeebe  staff   263B Dec 29 15:32 pip*  -rwxr-xr-x  1 wbeebe  staff   263B Dec 29 15:32 pip3*  -rwxr-xr-x  1 wbeebe  staff   263B Dec 29 15:32 pip3.11*  -rwxr-xr-x  1 wbeebe  staff   263B Dec 29 15:32 pip3.9*  -rwxr-xr-x  1 wbeebe  staff    34K Dec 29 15:32 powerline*  -rwxr-xr-x  1 wbeebe  staff   624B Dec 29 15:32 powerline-config*  -rwxr-xr-x  1 wbeebe  staff    13K Dec 29 15:32 powerline-daemon*  -rwxr-xr-x  1 wbeebe  staff   385B Dec 29 15:32 powerline-lint*  -rwxr-xr-x  1 wbeebe  staff   928B Dec 29 15:32 powerline-render*  

You need all the highlighted files for Powerline to work properly. For that, you'll need to add the path to bin to your full path in powerline.zsh, for example;

export PATH=$PATH:$HOME/Library/Python/3.9/bin

before you add the following line to powerline.zsh;

export PATH=$PATH:$HOME/Library/Python/3.9/bin

Once all of that is completed then you should at least get the colorful powerline prompt as seen in the screen capture at the top of this post.

For vi/vim, you need to add the following to your .vimrc configuration file;

  set rtp+=$HOME/Library/Python/3.9/lib/python/site-packages/powerline/bindings/vim  set laststatus=2  set t_Co=256  

Once that's in your vi configuration file, the status line should look like the following:

There's a lot more going on inside my vi config file, but the last three lines enable the bottom status line, and that's what's important here.

Comment
Like
Tip icon image You can also reply to this email to leave a comment.

Manage your email settings or unsubscribe.

WordPress.com and Jetpack Logos

Get the Jetpack app to use Reader anywhere, anytime

Follow your favorite sites, save posts to read later, and get real-time notifications for likes and comments.

Download Jetpack on Google Play Download Jetpack from the App Store
WordPress.com on Twitter WordPress.com on Facebook WordPress.com on Instagram WordPress.com on YouTube
WordPress.com Logo and Wordmark title=

Automattic, Inc. - 60 29th St. #343, San Francisco, CA 94110  

at December 30, 2023
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

$25 toward wine, on us

Join now to claim this limited-time offer from the Bon Appétit Wine Shop  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌...

  • Flourless pancakes
    Ingredients: 2 large ripe bananas 4 large eggs 1/2 teaspoon baking pow...
  • [New post] This tried-and-true Irish pub-inspired soup is creamy and thick with chunks of potatoes and leeks throughout.
    Emily Morgan posted: "This tried-and-true Irish pub-inspired soup is creamy and thick with chunks of potatoes and leeks thr...
  • Get Epicurious + Bon Appétit for just $30
      Brought to you by Bon Appétit ...

Search This Blog

  • Home

About Me

phoo, ramen, soba
View my complete profile

Report Abuse

Blog Archive

  • June 2026 (16)
  • May 2026 (18)
  • April 2026 (20)
  • March 2026 (16)
  • February 2026 (13)
  • January 2026 (15)
  • December 2025 (17)
  • November 2025 (18)
  • October 2025 (21)
  • September 2025 (19)
  • August 2025 (28)
  • July 2025 (25)
  • June 2025 (28)
  • May 2025 (34)
  • April 2025 (36)
  • March 2025 (39)
  • February 2025 (36)
  • January 2025 (43)
  • December 2024 (46)
  • November 2024 (51)
  • October 2024 (44)
  • September 2024 (1172)
  • August 2024 (1572)
  • July 2024 (1413)
  • June 2024 (1289)
  • May 2024 (1362)
  • April 2024 (1472)
  • March 2024 (1827)
  • February 2024 (2413)
  • January 2024 (2936)
  • December 2023 (2135)
  • November 2023 (1639)
  • October 2023 (1285)
  • September 2023 (918)
  • August 2023 (864)
  • July 2023 (795)
  • June 2023 (800)
  • May 2023 (796)
  • April 2023 (754)
  • March 2023 (649)
  • February 2023 (736)
  • January 2023 (1159)
  • December 2022 (968)
  • November 2022 (921)
  • October 2022 (852)
  • September 2022 (708)
  • August 2022 (766)
  • July 2022 (877)
  • June 2022 (684)
  • May 2022 (716)
  • April 2022 (698)
  • March 2022 (781)
  • February 2022 (734)
  • January 2022 (955)
  • December 2021 (1387)
  • November 2021 (3002)
  • October 2021 (3213)
  • September 2021 (3188)
  • August 2021 (3232)
  • July 2021 (1697)
Powered by Blogger.