# Installing ZSH, Oh-my-Zsh on Ubuntu, MacOS

Oh-My-Zsh is a framework for Zsh, the Z shell.

## 1. Install and set up zsh as default <a href="#heading-1-install-and-set-up-zsh-as-default" id="heading-1-install-and-set-up-zsh-as-default"></a>

The recommended terminal for MacOs is iTerm2. You can download [here](https://iterm2.com/downloads.html)

<figure><img src="/files/i1kzJ0rGM6l7H63E6FUe" alt=""><figcaption></figcaption></figure>

With Iterm2, your default shell is zsh.&#x20;

### 2. Install oh-my-zsh and Powerline fonts <a href="#heading-2-install-oh-my-zsh-and-powerline-fonts" id="heading-2-install-oh-my-zsh-and-powerline-fonts"></a>

To continue installing software on MacOS **Homebrew** need to be installed. Homebrew is a package manager that allows you to easily install, manage, and update software on macOS.&#x20;

To get started with Homebrew, you can install it using the following command in the terminal:

```
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```

Once installed, you can use commands like:

* `brew install` to install a package.
* `brew update` to update Homebrew and its package database.
* `brew upgrade` to upgrade all installed packages.
* `brew uninstall` to remove a package.

Homebrew is widely used for managing command-line tools and applications on macOS.

<figure><img src="/files/mwRFuw2f5XFNmCqxzdVj" alt=""><figcaption><p>Homebrew installation</p></figcaption></figure>

**Installing Powerline fonts**

Copy and paste these commands to your terminal.&#x20;

```bash
brew install --cask font-source-code-pro-for-powerline
```

### 3. Change to a brighter colors <a href="#heading-3-install-the-most-useful-plugins-for-zsh" id="heading-3-install-the-most-useful-plugins-for-zsh"></a>

You can use my colors profile.  You can get it [HERE](https://drive.google.com/drive/u/0/folders/1lNo5rwPPVQpEIRSVBbngYS9ZdvxCxPs-)

After that, go to **Iterm2 Settings** -> **Gerneral** -> **Settings** and **Import All Settings and Data...**

<figure><img src="/files/9GQa5KbIOXuR1JcFs9E8" alt=""><figcaption><p>Import Settings</p></figcaption></figure>

If you want to choose your color, select the Profiles tab then edit the color in **ANSI colors** by your favorite. (Set ANSI blue color to a brighter color. )

<figure><img src="/files/lFL94huWw4jLrxJzM5NE" alt=""><figcaption><p>Select Colors Presets ( Solarized Dark is recommended)</p></figcaption></figure>

* Set ANSI blue color to a brighter color. If you want to choose your color, select the Profiles tab then edit the color in **ANSI colors** by your favorite. Three main colors you can see simultaneously with the change in the terminal are:

  * Text color
  * Cursor color
  * Command color

  <figure><img src="/files/kXOmbvV7CJVJbay2CmjN" alt=""><figcaption><p>My Color Profile</p></figcaption></figure>

### 4. Using a fancy theme for zsh <a href="#heading-4-using-a-fancy-theme-for-zsh" id="heading-4-using-a-fancy-theme-for-zsh"></a>

Open .zshrc file using nano editor

```bash
nano ~/.zshrc
```

Find the line *ZSH\_THEME="robbyrussell"* and replace **robbyrussell** with the **agnoster** theme in the .zshrc File. After that, press CTRL + X and Enter to save.

<figure><img src="/files/mgZnCAO5ePHBnuuGFz1x" alt=""><figcaption></figcaption></figure>

### 3. Install the most useful plugins for zsh <a href="#heading-3-install-the-most-useful-plugins-for-zsh" id="heading-3-install-the-most-useful-plugins-for-zsh"></a>

The most useful plugins for zsh are syntax highlighting and autosuggestions.

```bash
brew install zsh-syntax-highlighting zsh-autosuggestions
```

<figure><img src="/files/s4VnxeAw19sZyw4MO519" alt=""><figcaption></figcaption></figure>

Add the plugin to the list of plugins for Oh My Zsh to load (inside \~/.zshrc):

```bash
nano ~/.zshrc
```

Find the line of enable plugins and add *zsh-autosuggestions* and *zsh-syntax-highlighting*

```bash
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1669906107498/ltRpFWeoJ.png?auto=compress,format\&format=webp)

**Ctrl+X** to close nano editor with key **Y** to save changes. After all, reload zsh to enable plugins with command

```bash
source ~/.zshrc
```

If for some reasons, plugins could not install, do it manually by downloading them and putting them in the correct path.

COPY

```c
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
```

<figure><img src="/files/GHAQo1yiTnbknLPEO6My" alt=""><figcaption></figcaption></figure>

* Install Powerline fonts
* Change the default font of the terminal to Powerline font
* Set ANSI blue color to a brighter color

{% hint style="info" %}
✅If the username and host always display at the beginning of the prompt make you feel annoyed, you can remove it permanently by following these steps:

COPY

```bash
nano ~/.oh-my-zsh/themes/agnoster.zsh-theme
```

Go to the bottom of file and comment out the line "prompt\_context"

<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1669912951825/3Br60d6Mx.png?auto=compress,format&#x26;format=webp" alt="" data-size="original">

Reload the shell and enjoy!

```bash
source ~/.zshrc
```

{% endhint %}

Resources:

* <https://gist.github.com/stramel/658d702f3af8a86a6fe8b588720e0e23>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev.3tsmart.org/2/installing-zsh-oh-my-zsh-on-ubuntu-macos.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
