Configuring the macOS Command Line: A Step-by-Step Guide
If you’ve recently acquired a new MacBook Air or simply want to optimize your macOS terminal for development, follow these instructions to set up your command line tool to perfection.
By default, the macOS terminal may not offer the optimal experience for developers. However, with a few adjustments and installations, you can transform it into a powerful tool.
Begin by installing Homebrew, a package manager for macOS. Visit the official Homebrew website at brew.sh and execute the following command in your terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
This command will initiate the installation process, which will include the download of the Xcode command line tools from Apple. Please note that the installation may take some time.
Once Homebrew is successfully installed, proceed to install the Fish Shell. Run the following command in your terminal:
brew install fish
After installing Fish Shell, make it your default shell. Open your terminal and type:
sudo vim /etc/shells
This will open the shell configuration file in the VIM text editor. Press the i
key to enter insert mode, then add /opt/homebrew/bin/fish
at the end of the list. To save the file and exit VIM, press the esc
key and type :wq
.
To change your default shell to Fish, enter the following command:
chsh -s /opt/homebrew/bin/fish
Once you’ve completed these steps, open a new terminal window to see Fish Shell in action.
To customize your terminal further, enter fish_config
in your terminal to access the configuration tool. Select a theme that you like and set it as your preferred theme by clicking “Set Theme.” You can also choose a favorite prompt style by clicking on “Prompt” and then “Set Prompt.” For example, the “Rubbyrussell” theme is a popular choice.
Exit the configuration tool by pressing enter
in the shell.
Now, it’s time to give your terminal some color. To do this, you’ll need to adjust the background settings in the Terminal app preferences. Press cmd-,
or go to Terminal -> Preferences
to access the preferences menu.
To explore a wide range of available themes, visit the GitHub repository at https://github.com/lysyi3m/macos-terminal-themes. Select a theme you like, such as “Dracula,” and click the “Raw” button. Save the theme file as Dracula.terminal
on your computer.
As the downloaded theme is not a signed binary, right-click on the saved file and choose “Open” to run it. macOS may prevent it from running due to security measures. Once the theme is opened, it will be applied in the terminal configuration.
Additionally, you can enhance the appearance of your terminal by modifying the font. Consider using Fira Code, a free font designed specifically for programmers. Download Fira Code from the official GitHub repository at https://github.com/tonsky/FiraCode. Open the ttf
folder, select all files, right-click, and choose “Open” to install the font.
Return to the terminal configuration tool and set Fira Code as the theme font. Open a new terminal window, and you should observe the changes take effect.
Congratulations! You’ve successfully configured your macOS command line to your liking.
tags: [“macOS”, “command line”, “Fish Shell”, “Homebrew”, “terminal customization”, “programming fonts”]