# Configuring the macOS command line

> Learn how to set up the macOS command line from scratch, installing Homebrew, switching your default shell to Fish, and customizing it with fish_config.

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2019-02-10 | Updated: 2021-10-28 | Topics: [DevTools](https://flaviocopes.com/tags/devtool/) | Canonical: https://flaviocopes.com/macos-terminal-setup/

> See my [how to use the macOS terminal](https://flaviocopes.com/macos-terminal/) post too

# How to setup the macOS command line
I just got a new MacBook Air to replace my beloved 2010 MacBook Pro, and I decided to document the process of setting up the command line.

By default here's what we have:

![Default macOS Terminal with basic bash prompt showing Flavios-MacBook-Air hostname](https://flaviocopes.com/images/macos-terminal-setup/Screenshot_2019-01-29_at_18.34.04.png)

We're going to have a much better terminal at the end of this article.

First thing is, install [*Homebrew*](https://flaviocopes.com/homebrew/). Head to https://brew.sh and copy the magic formula in your terminal, which should be:

```bash
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```

This will take care of installing the Brew package manager, which is an incredible tool. It will take some time as it needs to download the Xcode command line tools from Apple.

![Homebrew installation output showing Xcode Command Line Tools download and installation progress](https://flaviocopes.com/images/macos-terminal-setup/Screenshot_2019-01-30_at_07.41.04.png)

Next thing, we install the [*Fish Shell*](https://flaviocopes.com/fish-shell/). Run `brew install fish`.

Now we need to make Fish our default shell. Run `sudo vim /etc/shells`, and press the `i` key to enter *insert mode*, then add `/opt/homebrew/bin/fish` at the end of this list.

Now press the `esc` key and then type `:wq` to save the file and exit the editor.

Type `chsh -s /opt/homebrew/bin/fish` to change your default shell to Fish.

Try opening a new terminal window, you'll see Fish greeting you:

![Fish shell greeting message showing Welcome to fish, the friendly interactive shell](https://flaviocopes.com/images/macos-terminal-setup/Screenshot_2019-01-30_at_07.48.13.png)

Time to add some colour. Type `fish_config` to enter the (awesome) configuration tool:

![Fish shell configuration web interface showing color themes including Current, Solarized Light and Dark options](https://flaviocopes.com/images/macos-terminal-setup/Screenshot_2019-01-30_at_07.49.11.png)

Pick one theme and press "Set Theme". Then click the  `prompt`  to set the favourite prompt and click "Set Prompt". My favourite is Rubbyrussell:

![Fish shell prompt configuration showing Robbyrussell prompt selected with Set Prompt button](https://flaviocopes.com/images/macos-terminal-setup/Screenshot_2019-01-30_at_07.51.52.png)

Now exit and press `enter` in the shell, to close the configuration program.

Your shell should now have a nice prompt, and colours! We just need to change the background - that needs to be set in the Terminal app preferences.

![Terminal with Fish shell showing colorful prompt and directory listing with folder shortcuts](https://flaviocopes.com/images/macos-terminal-setup/Screenshot_2019-01-30_at_07.53.34.png)

Press `cmd-,` or click `Terminal -> Preferences`.

Go to this [GitHub](https://flaviocopes.com/github/) repository: https://github.com/lysyi3m/macos-terminal-themes.

![GitHub repository page for lysyi3m/macos-terminal-themes showing terminal color schemes collection](https://flaviocopes.com/images/macos-terminal-setup/Screenshot_2019-01-30_at_08.00.10.png)

There is a huge number of great themes to choose from. One I like is Dracula (https://github.com/lysyi3m/macos-terminal-themes/blob/master/schemes/Dracula.terminal)  Just click the "Raw" button and save it as `Dracula.terminal`.

Right-click it and click "Open", as it's not a signed binary (otherwise macOS prevents it from running). That's it! The theme is now applied and available in the configuration:

![Terminal with Dracula theme applied showing dark background with colored text and Fish shell prompt](https://flaviocopes.com/images/macos-terminal-setup/Screenshot_2019-01-30_at_08.01.19.png)

![Terminal Preferences window showing Profiles tab with Dracula theme selected and font settings](https://flaviocopes.com/images/macos-terminal-setup/Screenshot_2019-01-30_at_07.59.39.png)

Next thing, the font. I like to use Fira Code, a free programmers friendly font with ligatures (the nice things with arrows).  Download it from https://github.com/tonsky/FiraCode, open its `ttf` folder, select all files, right-click and press `Open` to install it.

![Finder window showing FiraCode font files selected for installation including Bold, Light, Medium, Regular and Retina variants](https://flaviocopes.com/images/macos-terminal-setup/Screenshot_2019-01-30_at_08.12.21.png)

Go back to the terminal configuration, and set it as your theme font. Open a new window, and it should be working fine:

![Final terminal setup showing Fish shell with Dracula theme and FiraCode font displaying colorful directory listing](https://flaviocopes.com/images/macos-terminal-setup/Screenshot_2019-01-30_at_08.13.24.png)

That's it!
