Hot answers tagged

59

First, some important things: Bash isn't going away. If you're already using bash, nothing will change for you. All that changes is that zsh will be the default login shell for new accounts, and even then, you can select bash instead. Scripts are not affected. What changes is the shell for interactive use, i.e. the shell in terminals (and also a few other ...


39

macOS Catalina and later (10.15+) Apple replaced bash with zsh as the default shell. See article. So no need to do anything. You can verify the default shell by typing echo $0 in the terminal. macOS Mojave and earlier (10.14-) See Apple Support page, Use zsh as the default shell on your Mac Surprisingly this doesn't work with the command line tools as ...


36

If your friend changed the command that shells are opened with, you can change it back to the default login shell from Terminal's preferences: If the default login shell was changed, you can change it back to /bin/bash by running chsh -s /bin/bash. zsh is included with OS X (in /bin/zsh), but even if your friend installed a newer version of zsh, you don't ...


23

If your default system shell is bash, your Terminal should start with it. You can check it on General tab under Terminal Preferences. Should look like the following: If bash isn't your default shell, you can change it by typing: chsh -s /bin/bash To configure iTerm2 with zsh you have to open Preferences and change the command on General tab on your ...


17

The final problem is related to zsh. oh-my-zsh is executing bracketed-paste-magic, so I ended up removing it. Because oh-my-szh doesn't have a plugin manager for this. You have to override the file: $ZSH/lib/misc.zsh The overrides will be in this folder $ZSH_CUSTOM. Because I don't have any override I had to create the folder first: mkdir $ZSH_CUSTOM/lib/...


17

You can squeeze the white spaces into a single white space in ls 's output then use cut. ls -l /usr | tr -s ' ' | cut -d ' ' -f3 but avoid parsing ls output. Here's an alternate solution. stat -f'%Su' /usr/*


14

Change your shell now and test - no need to wait. chsh -s /bin/zsh All the scripts that depend on bash syntax will still find and call bash. the same bash from Mojave is shipping on Catalina and migrated users keep their old shell. Also, I would estimate 95% of macOS users don't use a command line and of those that do, another 95% won't have to change ...


11

Whether zsh checks for new mail can be adjusted through the MAILCHECK parameter as described in zshparam(1). It specifies the interval in seconds between checks for new mail, a zero turns off the checks completely. So just put this into your zsh configuration file: # don't check for new mail MAILCHECK=0


11

ls doesn't use tabs, cut doesn't work with a variable number of delimeters between fields. ls -l /usr | awk '{print $3}' will work, or ls -l /usr | awk 'NR > 1 {print $3}' if you want to skip the first line (total 0 in your example).


8

So apparently some program (probably my MAMP) put an email in /var/mail/ Deleting this message did the trick...


7

It tells you that you have received some mails (for example, because of your configuration of cron). The best way is to read this mail. Type mail: at least one mail should appear. You can read by typing its number ID. You can also directly delete it (or even multiple mails) by typing d 1-1344 (1-13441 being the range of your new mails' IDs). Leave mail ...


7

If you're joined to an Open Directory sever, or any other directory server, the default shell will have to be specified there. You can always just add zsh to your bash profile so it gets called on logon as a workaround.


7

In zsh you need to enable the completion system. Please read through man zshcompsys. To install the completion system enter the command compinstall and follow the directions. Check the fpath variable echo $fpath in my situation I needed to declare the variable in my .zshrc fpath=(/usr/local/share/zsh/5.0.7/functions) This is the location of my zsh ...


6

Do you have a custom PS1 that is overriding the prompt from the theme you have selected? Check you don't have any additional lines in ~/.zshrc beyond the default? Backup your .zshrc Delete all lines beyond export PATH=$PATH:/… Reload your Terminal Do you have any plugins that are messing with things? Check ~/.oh-my-zsh/custom/plugins/ for any additional ...


6

This behavior seems to be caused by zsh’s bracketed paste feature, which is on by default as of version 5.1. I found that if I added unset zle_bracketed_paste to my zshrc then dropping files onto Terminal works correctly with zsh 5.2. (This blog post mentions bracketed-paste-magic, which seems like it could be used to support dropping files without ...


6

My shell scripts are really not that complicated Do your shell scripts have shebang lines (begin with #! /bin/bash or similar)? If not, you might have unintentionally been using a bash feature, where it runs scripts without a shebang using bash. Other shells, like dash or zsh, leave it up to the OS, which would usually use /bin/sh instead. /bin/sh on macOS ...


5

How did you uninstall it? The title bars in the screenshots show that the current command is still zsh, or maybe /bin/zsh. If you changed this setting in Terminal's preferences, change it back to the default login shell: If you changed the default login shell, you can change it back to /bin/bash with chsh -s /bin/bash.


4

Do you have your iTerm profile set to report 256 colors?


4

The problem was the "iTerm" app's conflicting settings with the shell. To resolve, I've reset "login shell" command in iTerm preference window: iTerm.app -> Preferences -> Profiles -> General -> Command -> Click on "Login shell" Then, I executed chsh to modify it as /bin/zsh. To reproduce the problem (having $SHELL set as /bin/bash/, even though the ...


4

If you can't restore /usr/ from a backup, you could first start up in single user mode (by holding command-S on startup) and run chown -R root /usr/. On my installation, all files under /usr/local/ were owned by either root or me, a few files under /usr/ were owned by _uucp, and all other files under /usr/ were owned by root: $ sudo find /usr/local ! -user ...


4

First, you don't want to remove the any of the command line tools that apple provides unless you want an unstable / unusable system. However in traditional Unix/Linux fashion you can set up your path statement to check /usr/local/bin first, thus utilities installed there (default for homebrew) will be used before /usr/bin (or /bin). The remaining issue is in ...


4

Add the following to your path to replace the OS X tools with Homebrew Coreutils: $(brew --prefix coreutils)/libexec/gnubin Per zsh syntax… path=($(brew --prefix coreutils)/libexec/gnubin $path)


4

The fix. Install homebrew. Install reattach-to-user-namespace: brew install reattach-to-user-namespace Then create an alias which your shell can use: alias open='reattach-to-user-namespace open'


4

.zshrc is a file run when you start an interactive zsh shell, found in your home directory. The error message says you have an export command which is written incorrectly on line 48. not valid in this context means you're trying to export something that's not a variable. It looks like you're trying to add stuff to your PATH, but are substituting the current ...


4

Just tap the Tab key twice (TabTab). You'll be prompted if you want to see all possible commands. Tap y and you'll be presented with a list. You can do that same thing for individual commands to see all options for that specific command.


4

I found the setting that turns this off, it's in advanced preferences. Not sure you can make it look like the normal terminal one, but this might help folks that want to get rid of the key entirely. iTerm2 > Preferences > Advanced > Experimental Features > "Show key at cursor at password prompt" => No


4

it is weird, I had the exact issue this morning with iterm2. I ended up adding the following to my ~/.zshrc: export LESS=-R Important: you might want to take a look at the flags you are using before running this command and understanding what each of them do. Sources I looked at to arrive to this conclusion: https://askubuntu.com/questions/803486/can-i-...


4

Bash Since Bash is typically the default shell you can open up this file in your home directory: $ vim ~/.bash_profile And add your variable to this file: export ENV_VAR=12345 You can do this without even having to edit this file if you like, using the following one-liner: $ echo 'export ENV_VAR=12345' >> ~/.bash_profile And then confirm like so:...


3

Position the cursor where you want to begin copying. Press v (or upper case V if you want to cut whole lines). Move the cursor to the end of what you want to copy. Press y. Move to where you would like to paste. Press P to paste before the cursor, or p to paste after. Source: http://vim.wikia.com/wiki/Copy,_cut_and_paste


Only top voted, non community-wiki answers of a minimum length are eligible