Customize Your macOS Terminal Using Starship
最后更新 April 11, 2024

It is a Whole Vibe

As someone easily drawn to pretty and aesthetic things, customizing my macOS terminal to create an environment I resonate with has helped improve my productivity and simplify complex tasks. In this blog, I'll show you how to create your own vibe by using Starship.

Ready to customize your terminal? Let's go!

What Is Starship?

Starship is an open-source, customizable prompt for shell environments used in command-line interfaces (CLI). It is available on Android, BSD, Linux, macOS, and Windows; in this blog, I will be giving you instructions for macOS. It allows users to easily modify its appearance and the type of information it shows, such as Git status or programming language versions, by editing a simple configuration file. It's designed to be quick and light, so your work won't be slowed down in the terminal. A key advantage of Starship is that it works with various shells like Bash, Zsh, and Fish, keeping the terminal experience consistent and efficient. This means you can use it in different environments without needing to adjust to a new setup each time.

This gif shows a customized terminal with colorful words in a unique font being typed.Demo of Customized Terminal

Source: starship.rs

Now, let's open our terminal to get started!

How to Set Up Starship

  1. Install Starship: run curl -sS https://starship.rs/install.sh | sh in your terminal.

Alternatively, if you have brew installed, you can do a quick brew install starship.

  1. Set Up Your Shell: Choose and configure your shell. Starship supports a list of different shells. For this blog, I will be using Zsh.

Next, run: nano ~/.zshrc

Once the file is open in nano, add the following to the end of ~/.zshrc: eval "$(starship init zsh)"

Once you've saved the changes with Ctrl + O in nano, you can simply exit nano with Ctrl + X, and your changes will be applied to the configuration immediately.

  1. Choosing the Right Font: You can choose whatever font you'd like. I downloaded FiraCode Nerd Font because it is readable and compatible with a wide range of development tools and environments.

    This image displays a window from the macOS font book titled 3 typefaces showing FiraCode Nerd Font as a dropdown option.Font Book

    Once you've chosen your font and clicked "Download", locate the downloaded zip file in your Downloads folder. Double-click the zip file to extract its contents. This action should create a new folder containing the font files. Open that new folder to view the font files inside.

Select all the font files (usually with .ttf extension) that you want to install. Right-click on the selected font files and choose "Open" or "Open with" -> "Font Book" (macOS's default font manager).

The Font Book will open and display the selected font files.

This image displays a window from the macOS font book titled 3 typefaces showing FiraCode Nerd Font as a dropdown option.Font Book

Click "Install Font" for each font variant you want to install (regular, bold, italic, etc.). Alternatively, you can drag and drop the font files into the Font Book window to install them. Once that is done, you should see your new font in your Font Book under "My Fonts".

This image shows the window titled Profiles from Terminal with the Text tab opened, showing that FiraCode Nerd Font is set as the font.Terminal Profiles

Once the fonts are installed, you can verify their installation by opening your terminal. At the top left of your screen, click on "Terminal" -> "Settings" (a "Profiles" window will appear). Click "Profiles". If you see the FiraCode Nerd Font options in the font selection dropdown, it means the fonts are successfully installed. Select it, and you'll see the terminal font change.

This image shows the window titled Profiles from Terminal with the Text tab opened, showing that FiraCode Nerd Font is set as the font.Terminal Profiles

  1. Create and Edit the Starship Configuration File: Since you're working in a terminal, you can use a command-line text editor like Nano, Vim, or Emacs. I chose Nano because it is pretty user-friendly.

Type the following command in your terminal to create and edit the starship.toml file: nano ~/.config/starship.toml

Customizing Starship

This is where you get to change the terminal. You can change every aspect of your prompt through the starship.toml file.

Configuring Starship:

I was inspired by therubberduckiee's terminal, so I used her dev environment file as a template. Copy and paste the contents of this file into your starship.toml file, and change the HEX codes to whatever you want. I replaced her colors with the Vonage colors' HEX codes:

Color HEX Code
Purple 871FFF
Magenta D62190
Cyan 80C7F5
Peach FFA68C
Orange FA7554

The image displays a color chart with six colors, each accompanied by their respective RGB, HEX, CMYK, and PMS codes. The colors and their codes are:  Purple: RGB (135, 31, 255), HEX #871FFF, CMYK (79, 87, 0, 0), PMS 2090C Magenta: RGB (214, 33, 156), HEX #D6219C, CMYK (16, 100, 0, 0), PMS 2405C Cyan: RGB (128, 199, 245), HEX #80C7F5, CMYK (50, 0, 0, 0), PMS 2141C Peach: RGB (255, 166, 140), HEX #FFA68C, CMYK (0, 42, 32, 0), PMS 487C Orange: RGB (250, 117, 84), HEX #FA7554, CMYK (0, 68, 68, 0), PMS 2024C The chart is organized in blocks of color with the information below each color, set on a white background for clear readability.Vonage Colors

If you need to find your color choices' HEX codes, use a tool that gives information about colors calculated in a color page like Color Hex.

Save your changes, and your terminal should be good to go!

Try Out Your New Terminal

Now, let's see these beautiful changes. I used Visual Studio Code and opened my terminal there. Here are commands you can run in your terminal to see your customization:

Install Vonage CLI: npm install --location=global @vonage/cli

The image shows the output of a package installation using npm. The terminal prompt displays the current time in purple and pink, a peach-colored location indicator, and a command running with the output message Completed in 191930ms highlighted in cyan.Install

Check your installed version: vonage --version

The image (version.png) displays the output for the version check of the Vonage CLI. The prompt includes the same colored elements as before, and the output shows the Vonage CLI and Node.js versions installed on the system.Version

After creating your Vonage developer account, you can find your API Key and API Secret on your dashboard. Set your configuration: vonage config:set --apiKey=XXXXXX --apiSecret=XXXXXX

The image shows the successful configuration of the Vonage CLI with an API key and secret. The output message Configuration saved confirms the action, and a deprecation warning for a module is also shown.Config

To see your current Vonage apps, use: vonage apps

The image (apps.png) depicts an attempt to display Vonage applications, but it only shows the column headers Name and Id without any entries. A deprecation warning for the punycode module is repeated here as well.Apps

For more information on how to create and manage your Vonage application, follow the documentation for the Vonage CLI or Michael Crump's blog "Better together: GitHub & Vonage CLI".

Conclusion

This blog taught us how to customize our macOS terminal using Starship and tested it with the Vonage CLI. As developers, our environment is key to our productivity, so why not make it as unique as the code we write? If you need help creating a pretty terminal, drop a message into our community Slack channel. If you end up following this tutorial, feel free to share your terminal on X, formerly known as Twitter, and tag me. I'd love to see your new environment!

Diana PhamDeveloper Advocate

Diana is a developer advocate at Vonage. She likes eating fresh oysters.

Ready to start building?

Experience seamless connectivity, real-time messaging, and crystal-clear voice and video calls-all at your fingertips.

Subscribe to Our Developer Newsletter

Subscribe to our monthly newsletter to receive our latest updates on tutorials, releases, and events. No spam.