Questions tagged [zsh]

Zsh or Z Shell is the default Unix shell used by Terminal in macOS since 10.15

Filter by
Sorted by
Tagged with
283 votes
4 answers
152k views

What are the practical differences between Bash and Zsh?

With the news that Catalina will default to Zsh instead of Bash, I'm finding lots of results telling me about the switch, and that it may cause problems with shell scripts, but I'm not familiar enough ...
  • 4,990
113 votes
1 answer
101k views

ZSH: .zprofile, .zshrc, .zlogin - What goes where?

Now that I've upgraded to Catalina and I am using the new ZSH shell, I've noticed that ~/.bash_profile has been replaced with ~/.zprofile and since installing iTerm2 shell integration, it added a ~/....
  • 83k
68 votes
7 answers
162k views

How to add permanent environment variable in zsh

I have been scouring the internet, and cannot seem to find a solution to permanently adding an environment variable, specifically when my OS is macOS Mojave (10.14). It seems there are a lot of ...
49 votes
2 answers
96k views

zsh: bad CPU type in executable

I am using the terminal on an Apple M1 MacBook. I try to use a cli tool that is not build for aarm64, so I get this error message in the terminal: zsh: bad CPU type in executable Is there anything I ...
  • 5,533
33 votes
1 answer
170k views

How to uninstall zsh

I'm new to Mac. A friend installed all kinds of additional software including zsh which I would like to uninstall. So how can I uninstall zsh?
  • 1,470
29 votes
4 answers
38k views

Change default shell from bash to zsh

I've tried to switch my default shell to zsh, using chsh: chsh -s /bin/zsh and: chsh -s `which zsh` Both commands ended with: Changing shell for adamatan. Password for adamatan: chsh: Operation ...
  • 3,469
25 votes
1 answer
100k views

How do I configure my Terminal app with bash and iTerm2 with zshell and oh my zsh?

The Terminal app uses bash by default. And I don't want to change it. However I want to configure iTerm2 with zshell and oh my zsh. and I don't want bash on it. The instructions I checked online, make ...
  • 477
25 votes
3 answers
12k views

ZSH paste from the clipboard a command takes a few second to be write in the terminal

When I copy from the clipboard a long string command in my iTerm, the terminal freeze for seconds. for example, if I copy the following test and I paste in my iTerm console: echo 'test test test ...
24 votes
1 answer
30k views

Bash or Zsh, what's the difference, why use one or the other? [duplicate]

So, the question pretty much says it all. I'm on Snow Leopard, and I do a lot of web development, particularly in Rails 3 which makes heavy use of the console. I've seen some notable bloggers etc. ...
  • 405
24 votes
1 answer
14k views

zsh comment character

Many bash scripts invoke the #character to indicate a comment. Catalina migrated to zsh. The command: # Comments should elicit no response returns zsh: command not found: # I find useful command ...
  • 2,463
17 votes
3 answers
52k views

How do I add a directory to PATH when using `zsh` in Sierra

In macOS Sierra 10.12.x, what is the modern way to add a directory to the PATH environment variable that can work across shells or specifically work with zsh shell (I switched from the default bash to ...
16 votes
5 answers
20k views

How to get rid of "You have new mail." in zsh

I'm using zsh with prezto as my shell with iTerm as terminal app. I always get the message "You have new mail" when opening a new prompt. I don't have any new mail in Mac Mail and I don't run a mail ...
16 votes
4 answers
11k views

How do I switch tabs when using iTerm2 with Z shell

How do I switch tabs when using Z shell on iTerm2? I have already tried all the possible key combinations. Here is an image of my current setup: OS: macOS Mojave 10.14.4 (18E226) iTerm2: Build 3.3....
  • 261
15 votes
4 answers
8k views

Why can't I use zsh?

So I upgraded to Catalina. Actually it's more like a fresh install, I only copied across the few files I wanted to keep. The shell is now helpfully telling me: The default interactive shell is now ...
  • 418
14 votes
6 answers
36k views

How to change the default shell in iTerm?

I'm having some difficulties in changing the value of $SHELL in OSX's iTerm app. iTerm is starting in /bin/zsh, but the value of $SHELL doesn't seem to change. What I've done: Changed "command" as /...
  • 308
12 votes
4 answers
5k views

I switched to Catalina and enabled ZSH now my home/end key do not work in terminal

I switched to ZSH from BASH as per the upgrade in Catalina and all is well except my home/end keys no longer work. This can be really annoying trying to move my cursor over super far to the left ...
10 votes
1 answer
955 views

Issues with Unicode symbols in some applications running in Terminal.app and iTerm2

Darwin DeoGloria 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun 3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64 Fresh user account. Terminal.app and iTerm2 with UTF-8 set. Accented ...
  • 101
9 votes
3 answers
4k views

Now that MacOS Catalina has moved to zsh, can I upgrade bash 3.2.57 with 5.0.3?

I understand apple's move from bash to zsh, though I'd really rather that they hadn't made the change. I've tried zsh, and decided that I'd prefer to remain with bash. So, since MacOS Catalina isn't ...
9 votes
1 answer
5k views

Easiest way to migrate aliases from bash to zsh

I want to start using zsh as recommended by Apple for Mac OS Catalina. How do I migrate my aliases that I have defined in the ~/.bash_profile to the new shell?
  • 2,425
9 votes
2 answers
73k views

How can I get zsh to show the current path in the prompt?

I am not able to see path of my current directory or even username in terminal while using zsh. I was able to see it until few days back. Now it just shows blank. I tried uninstalling oh-my-zsh but it ...
8 votes
5 answers
4k views

I accidentally used "touch .." , is there a way to safely delete this document?

I am using zsh, macOS 11.0.1 (Big Sur), was working on a project and for some stupid reason I decided to write touch ... A file was created in the Desktop so I don't think that it will affect the ...
  • 191
8 votes
3 answers
2k views

Did the shell ( terminal ) change in Catalina?

My login script is behaving oddly since I moved to Catalina. Particularly this line: # set cursor to display path and command count PS1="<: \w | \! :> " Now my cursor actually has a \w and a \...
  • 191
8 votes
1 answer
7k views

Is it possible .zshrc is not available in ~?

I can’t find the file .zshrc in my user home folder, is it possible it doesn’t exist and I have to create it as a new file? I use zsh as default shell on macOS 11.2.3
's user avatar
8 votes
1 answer
3k views

Update zsh on macOS Mojave

On my MacBook Pro with macOS Mojave, my version of zsh is 5.3. zsh --version zsh 5.3 (x86_64-apple-darwin18.0) That version is a few years out-of-date, according to this. That page shows version ...
7 votes
4 answers
2k views

How to prepend a character to start of each line in 250,000+ line file using a script?

I have text file with 250,000 lines - and I need to append the same single character at the start of each line. I have tried to use various multiline /column edit plugins in Atom and Sublime but they ...
  • 71
7 votes
2 answers
40k views

zsh themes loaded but not working

I set theme in .zshrc file: ZSH_THEME="random" And when open new tab, it shows that new theme is loaded: [oh-my-zsh] Random theme '/Users/maks/.oh-my-zsh/themes/gozilla.zsh-theme' loaded... mac ...
7 votes
1 answer
698 views

difference ZSH and BASH for $RANDOM?

I just switched from Ubuntu to macOS (due to work reasons). And I wanted to transfer my bash aliases to zsh, but they are not working completely. alias HPC1='ssh -l [username] [server1]' alias HPC2='...
7 votes
3 answers
1k views

$PATH vs. $path

I can't remember why, but a long time ago, I found that for some reason, I needed to set both of these variables. It caused no problems in bash, but now in zsh, when I put export PATH=~/bin:/opt/...
  • 3,531
7 votes
1 answer
4k views

Scrolling doesn't work in Terminal for commands like less

I used to be able to scroll using the trackpad through git diff or man pages which both use less when the output doesn't fit on screen. Today I restarted my computer and that behaviour is gone and I ...
  • 2,827
7 votes
1 answer
21k views

Big Sur switched to zsh terminal but still uses .bash_profile

I've upgraded to Big Sur and noticed my user was still using bash shell, so I changed Users → Advanced Options → Login shell to /bin/zsh and restarted. The shell that starts appears to be zsh insofar ...
6 votes
4 answers
20k views

ZSH - missing git icons

Hi I've just installed ZSH and it looks awesome but git icons are still missing and I don't know what I miss. What I should do?
  • 319
6 votes
1 answer
4k views

What does the time command do on zsh Mac terminal? And what is the output of "children"?

This is what I got from the terminal command "time". shell 0.32s user 0.08s system 0% cpu 6:09.64 total children 0.10s user 0.16s system 0% cpu 6:09.64 total What is children?
6 votes
3 answers
2k views

How to get fn + left key working on macOS after changing to zsh from bash?

In case it is not clear fn + left key is simply the HOME button. It takes you to beginning of line. This seems to still work when editing a file (in vim) say so I think zsh does something with the ...
  • 189
6 votes
2 answers
7k views

zsh: no matches found

It seems I have some zsh misconfiguration. I use youtube-dl regular to download videos. But since a few days, I get this error youtube-dl https://www.youtube.com/watch?v=mkd6JkfI4yk zsh: no matches ...
6 votes
2 answers
4k views

zsh-autosuggestions: How to install zpty module?

I love zsh-autosuggestions and found in the README: completion: Chooses a suggestion based on what tab-completion would suggest. (requires zpty module) With a web search I din't find out what zpty ...
  • 3,461
6 votes
2 answers
4k views

How can I change my shell language localization on the macOS command line?

I have a Mountain Lion macbook and it's default locale is english, it's keyboard is english (US) as well. I need to change the language that the terminal replies to Swedish. For example, Instead of ...
  • 71
6 votes
1 answer
520 views

Separate zsh histories after restart (iTerm2)

I am running iTerm2 (v 3.2.9) and zsh (v 5.7.1). I normally have 3-4 iTerm tabs opened at the same time and each tab has its own history thanks to the following settings in my .zshrc file SAVEHIST=...
  • 1,164
6 votes
0 answers
3k views

rbenv not overriding default Ruby version

I used the thoughtbot laptop script to setup a new Macbook Air (OSX 10.10.5), but when I navigate within a Rails project that contains a .ruby-version file, running commands such as rails s returns an ...
5 votes
2 answers
908 views

Cut in CLI doesn't work as expected - returns full lines every time

I'm running MacOS Mojave and I'm trying to get a list of owners of files in given path. I'm trying to do it like this but it doesn't work. $ ls -l /usr | cut -f3 total 0 drwxr-xr-x 971 root wheel ...
  • 153
5 votes
1 answer
3k views

Why is ~/.zprofile always sourced on every interactive session?

from zsh document, ~/.zprofile should only be sourced at login shell, and should NOT be sourced at every interactive session (for example, a new tab in a terminal). I am running MacOS Big Sur 11.2.3 (...
  • 1,745
5 votes
1 answer
16k views

macOS Big Sur and bash

In Catalina, Apple made ZSH the default shell, however, macOS retained the (now deprecated) Bash. Despite my attempts to unearth something related to this, I couldn't find out whether Big Sur will ...
5 votes
2 answers
4k views

Zsh vs Bash shell in Terminal [duplicate]

Are there any advantages to using zsh vs bash shell in Terminal app? Also, can you use zsh from the terminal? My understanding of zsh is skewed.
5 votes
1 answer
1k views

ZSH terminal displaying characters and cursor in the wrong place

When my command is long and I move the cursor through it, it jumps randomly to different places and start writing in any location of the command. I'm using OS X El Capitan (10.11.6) and have ...
5 votes
1 answer
637 views

Tail terminal command is extremely slow when processing files with long lines

The tail command has become unusably slow for large files (e.g. 1 GB text file). EXAMPLE: $ tail -265000 file.txt > last_265000.txt takes 10+ minutes, whereas $ head -265000 file.txt > ...
  • 161
5 votes
1 answer
17k views

How can I change my font and coloring in Oh My Zsh to match a theme I want

I'm using Oh My Zsh and I was using the "Agnoster" theme for a while, but now I want to switch to "Amuse". So I went into my ~/.zshrc file and changed the theme config line to ...
  • 201
4 votes
5 answers
21k views

Is there a way to list all available commands in terminal

Is there a way to list all available commands in terminal? I know linux has compgen -c is there an equivalent command for OS X? Update: The actual issue was that I was using zsh instead of bash. So ...
4 votes
2 answers
1k views

Dragging and dropping a file onto a Terminal window doesn’t escape the path under zsh 5.2

Under OS X you can drag and drop a file from the Finder (or anywhere else) onto a Terminal window and the file’s path will be inserted as if you had typed it in. Recently, filenames with spaces have ...
  • 1,358
4 votes
2 answers
4k views

How can I convert this Bash prompt to zsh?

I have the following configuration for Bash: # Change Prompt # ------------------------------------------------------------ export PS1="...
  • 522
4 votes
2 answers
7k views

Uninstalled zsh, terminal gone weird

I uninstalled zsh pretty soon after I installed it as I realised I had got used to the normal Terminal. The uninstall went successfully and I restarted Terminal, but now it displays my computer-name (...
4 votes
2 answers
1k views

How do I use zsh to pipe results from one command to another (while in a loop)?

macOS 10.14.6 zsh 5.8 jq 1.6 I have a situation where I have a bunch of .vital files, which are JSON files in disguise. I want to extract one piece of information from each file, and I have worked ...

1
2 3 4 5
7