Zsh For Macos

  воскресенье 08 марта
      62

Zsh?

Zsh is the new default shell used in macOS Catalina and later. Find out how this impacts Terminal and your existing shell scripts. MacOS Catalina has a number of new features and capabilities, but one change that’s often overlooked is the new shell used in Terminal to interact with. Dec 08, 2019  One of the big changes in macOS 10.15 Catalina is that Apple has replaced the default bash shell in Terminal with zsh, a move that is sure to cause headaches for system administrators. Josh Centers offers some resources to help you adapt to the change.

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

  • In order for Oh-My-Zsh to work, Zsh must be installed.
    • Please run zsh --version to confirm.
    • Expected result: zsh 5.4.2 or more recent
  • Additionally, Zsh should be set as your default shell.
    • Please run echo $SHELL from a new terminal to confirm.
    • Expected result: /usr/bin/zsh or similar

Install and set up zsh as default

If necessary, follow these steps to install Zsh:

  1. There are two main ways to install Zsh
  • with the package manager of your choice, e.g.sudo apt install zsh (see below for more examples)
  • from source, followinginstructions from the Zsh FAQ
  1. Verify installation by running zsh --version. Expected result: zsh 5.4.2 or more recent.
  2. Make it your default shell: chsh -s $(which zsh)
  • Note that this will not work if Zsh is not in your authorized shells list (/etc/shells)or if you don't have permission to use chsh. If that's the case you'll need to use a different procedure.
  1. Log out and login back again to use your new default shell.
  2. Test that it worked with echo $SHELL. Expected result: /bin/zsh or similar.
  3. Test with $SHELL --version. Expected result: 'zsh 5.4.2' or similar

How to install zsh on many platforms

macOS

Try zsh --version before installing it from Homebrew. If it's newer than 4.3.9you might be OK. Preferably newer than or equal to 5.0.

To set zsh as your default shell, execute the following for macOS High Sierra

Assuming you have Homebrew installed. If not, most versions ofmacOS ship zsh by default, but it's normally an older version. Alternatively, you mayalso use MacPorts

Ubuntu, Debian & derivatives (Windows 10 WSL Native Linux kernel with Windows 10 build 1903)

If you don't have apt, the recommended package manager for end users [1] [2] [3] [4] , you can try apt-get or aptitude.

Other distributions that apply include:Linux Mint, elementary OS, Zorin OS, Raspbian, MX Linux, Deepin.

OpenSUSE

Arch Linux

Void Linux

Fedora

OpenBSD

To install the package:

FreeBSD

To install the package: Smart card reader software.

To install the port:

To reduce memory usage, optionally enable zsh-mem options with

before running 'make install'.

Centos/RHEL

Cygwin

Install the zsh package using the installer. Unfortunately Cygwin doesn't have a standard command line interface.

The easiest way to change the default shell is to set your SHELL user environment variable. Search for 'Edit Environment variables for your account' to bring up the environment variables window, create a new variable named 'SHELL' and give it the value '/usr/bin/zsh/'.

Alternatively:Open Cygwin (in BASH) then type:

Once the .bashrc file is open, add this line to the very top:

Close and save the file.Close and reopen Cygwin.It will execute the command every time you load the terminal and run your zsh shell.

Solus

Funtoo/Gentoo

Alpine Linux

MSYS2

Termux (Android)

Termux is an terminal emulator for Android but has modern feature like Debian and Ubuntu (Termux has Bash shell and Busybox GNU-like programs). For the package manager, Termux using an Debian/Ubuntu package manager, APT.To install the package, run this command:

The command looks like FreeBSD package manger (pkg). Or you can run this command:

To set zsh as your default shell, run this command:

Or:

Add yours

Zsh

If you know a platform that is not covered, edit this page and add it!