2022 Developer Survey is open! Take survey.

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
1 vote
1 answer
17 views

need to turn separate zsh script into a function inside a master script

I'm trying to turn 6 scripts into one script, so that instead of the enduser needing to download 6 scripts, do chmod +x mess to them etc, and then run the master script, they'd only need one script ...
user avatar
  • 1,090
0 votes
1 answer
42 views

How to use input variable in .zshrc alias?

I'm trying to create this alias: alias mrc="php artisan make:controller $(user_input) --resource" so that I can just type mrc ControllerName in the terminal to produce: php artisan make:...
user avatar
0 votes
1 answer
72 views

Most homebrew installed commands outputs "zsh: killed"

When I type brew, I get the output: zsh: killed brew Writing out the whole path still gives the same output, so it doesn't seem like a path problem. Furthermore, running /bin/bash gives the ...
user avatar
2 votes
2 answers
88 views

In Terminal, using the "touch" command to mass create consecutive files with leading zero's, with bash, produces different results than zsh

In Terminal, I prefer to use bash as my default shell. Issuing the command touch File_{01..10}.txt produces these results: File_1.txt, File_10.txt, File_2.txt, File_3.txt, File_4.txt, File_5.txt, ...
user avatar
  • 6,307
0 votes
1 answer
11 views

Is it possible to set a per-profile HISTFILE in iTerm2?

Let's say I have a "Work" profile in iTerm2 and want to set a different HISTFILE for this profile, called .zsh_history_work, so that I don't see my work commands showing up in my regular ...
user avatar
  • 7,435
0 votes
0 answers
25 views

Why does setting my MAC address take two attempts?

I'm new to SE so I'm not sure if this is the correct site, but I am trying to change my MAC address to a fixed value on startup of macOS using zshell (bash should be similar or the same ). I oddly ...
user avatar
0 votes
0 answers
60 views

zsh: command not found (some modules)

I used bash and installed different packages. But when i install zsh, some modules are missing, for example (angular cli, nvm - node version manager), but detected npm and node js. Why is this ...
user avatar
0 votes
0 answers
42 views

Debugging phantom zsh process

Every once in a while (once a week?) I noticed that my mac's fans are spinning full speed. When I investigate my processes on activity monitor I notice a zsh process consuming near 100% on the cpu. ...
user avatar
  • 121
0 votes
1 answer
54 views

Customizing PS1 for two rows similar to zsh Kali

I was hoping someone might be able to help me figure out how I can customize my PS1 on macOS zsh to look like Kali zsh. Here is $PS1 from Kali zsh: %F{%(#.blue.green)}┌──${debian_chroot:+($...
user avatar
0 votes
3 answers
337 views

zsh: command not found

I created a script , tried putting it in ~/.local/bin/script.sh and /usr/local/bin/script.sh but I get zsh: command not found: script This is my .zshrc file: cat .zshrc # If you come from bash you ...
user avatar
0 votes
0 answers
54 views

Parameterized ZSH alias

Hello I'm trying to make an alias in zsh for the following command: gcloud compute instances delete CONTAINER_NAME --zone=x --quiet How can I make an alias that would fit my parameter in the ...
user avatar
0 votes
0 answers
29 views

~/.ssh/rc is not executed when using ssh

I'm in the situation of having to connect to various systems via ssh to do some quick work and then leave without a trace. Before I do any work, however, I would like to set up some aliases to save ...
user avatar
0 votes
0 answers
97 views

oh-my-zsh syntax-highlighting the tab completion when doing cd

Been struggling some time now and can't seem to figure out why I can't get the tab completion to highlight the folders I 'tab' into My zshrc files looks like this # Enable Powerlevel10k instant ...
user avatar
0 votes
1 answer
57 views

Tab key no longer lists directory contents in zsh

Tab used to run an ls locally and in ssh sessions to offer suggestions, but this no longer works. It worked on my old Intel Mac, but now no longer works on my M1 MacBook. I've tried adding some ...
user avatar
2 votes
2 answers
280 views

How do I debug zsh when startup performance is slow?

I'm using Z shell inside iTerm2 every time I open up a new window or a new tab it takes around 8 - 9 seconds to load. I found some information on how to debug zsh. I came across this Speeding Up My ...
user avatar
0 votes
0 answers
25 views

Launchd unable to view contents of connected USB device

When I connect my USB device, I can open a terminal and run a script which returns a directory listing to a file in my home directory called ls.txt. It works and the contents of the script are: #!/bin/...
user avatar
0 votes
1 answer
25 views

I'd like to change the shell script instruction to the one available in the terminal

do shell script "bless -mount /Volumes/BOOTCAMP/ -legacy -setBoot -nextonly" password "0000" with administrator privileges tell application "System Events" restart ...
user avatar
0 votes
2 answers
71 views

Where to put a bash script that I want to run only from my user? [duplicate]

I am a new macOS user and I want to create a bash script that I can add to the PATH and run as a "normal" command (cd for example). I'm the only user of the Mac and so I'll be forever, but ...
user avatar
  • 103
1 vote
2 answers
214 views

What's the correct file to store environmental variables for zsh?

I'm a bit confused as to how all of this works. Seemingly every tutorial tells me something different. So far there's about 4 different files I can add environmental variables to: .zshrc .profile ....
user avatar
0 votes
1 answer
285 views

oh-my-zsh startup failure: __git_prompt_git status blocks

I have been installed iTerm2 and brew. In the process, I have some problems with my terminal. It doesn't show anything whatever I command it. That's all I can do is /bin/bash to return to bash. There ...
user avatar
  • 1
1 vote
2 answers
232 views

sudo ownership and permission changed and shows `sudo: /usr/local/bin/sudo must be owned by uid 0 and have the setuid bit set`

I made another admin account in my MacOS Monterey for my programming job. Then I had to change ownership of Homebrew directories to make it work. sudo chown -R $(whoami) /usr/local/Homebrew/ /usr/...
user avatar
  • 111
1 vote
2 answers
80 views

How to tell what shell is running from command line?

If I do sudo zsh, I can tell I am in zsh by examining ps -ef Is there an easier way? echo $SHELL says it's /bin/sh, because $SHELL is always the default shell, not necessarily the shell that's ...
user avatar
  • 3,355
5 votes
1 answer
296 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 > ...
user avatar
  • 161
0 votes
0 answers
327 views

Missing files from ZSH config

Have been experiencing some issues after installing NVM and was/ still am getting errors related to oh-my-zsh and powerlevel10k. At first, I was getting the following from pl10k: [WARNING]: Console ...
user avatar
-2 votes
2 answers
96 views

Why does globbing not work on X* or x*?

Due to a bug in Monterey, TextEdit quarantines any file it changes. xattr can fix it, and since I didn't know where such might be, I tried to do xattr -rc ~ But something in ~/Library prevents that ...
user avatar
  • 3,355
2 votes
1 answer
358 views

zsh does not find script in PATH while bash does (echo $PATH is the same)

I am trying to execute a script using just its name. So naturally I added it to the PATH variable. But it seems zsh does not care. If I switch to bash everything works fine. The following terminal ...
user avatar
  • 245
1 vote
1 answer
215 views

How to upgrade ssh on OS X 10.9 Mavericks without OS upgrade?

The ssh version 6.2 of OS X 10.9 (Mavericks) supports dsa and rsa, but not the newer Ed25519 keys. Ed25519 is there since OpenSSH version 6.5. As well as the old ssh-agent returns SHA-1 instead of SHA-...
user avatar
  • 3,496
0 votes
0 answers
33 views

problem with ls in ~/Downloads directory [duplicate]

How can I fix the broken ls command in the ~/Download directory in macOS? ~/Downloads  ls  ✔  at 02:01:06 PM ls: .: Operation not permitted
user avatar
2 votes
1 answer
84 views

Can't test whether key exists in associative zsh array

This is my script (zsh 5.8): # Consider parameter expansion of an unset variable to be an error set -u # Define and populate associative array typeset -A arr arr=(x xxx y yyy) echo $arr[x] # ...
user avatar
3 votes
1 answer
607 views

How to disable .zsh_history & .zsh_sessions on macOS?

By default in macOS zsh stores the history and sessions in the ~/.zsh_history & ~/.zsh_sessions files. However for one of my computers I want no Terminal/zsh history or session to be stored what ...
user avatar
3 votes
1 answer
85 views

I typed () in terminal and got a prompt. What is it for?

I typed () in Terminal and got a prompt: function> I can't find any zsh documentation about it (or if it is even related to zsh). I realized I can type any gibberish anygibberish() and also get ...
user avatar
  • 173
1 vote
1 answer
2k views

Command not found: /usr/local/bin/zsh

I uninstall homebrew on a Mac Mini M1 to reinstall it. After opening a terminal to run the install shell script, the terminal produces the following output and becomes unusable. [Command not found: /...
user avatar
  • 113
3 votes
2 answers
907 views

Convert PS1 prompt from bash to zsh for colour customisation

The macOS Monterey system uses zsh shell instead of bash, and I want to convert this bash command which you'd normally store in a .bash_profile file export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[...
user avatar
  • 61
0 votes
0 answers
45 views

In iTerm2, I can't run `ls` with both -a and -w flags. When I just run `ls`, I get columns, but when I run `ls -a`, it's all just in a single column

I'm transferring from Terminal to iTerm2 and am trying to set up my shortcuts. The problem is that when I run ls -a, everything is in one column whereas if I just run ls, it shows up in several ...
user avatar
  • 101
0 votes
1 answer
223 views

Use LS_COLORS (not LSCOLORS) on Mac OS

LSCOLORS does not give a lot of options or control for directory listings. I've tried several ways to use LS_COLORS (the standard method for such things) without success. Is it possible to bypass ...
user avatar
  • 159
0 votes
1 answer
370 views

Why does the shell run the incorrect Python?

I am coming from an Ubuntu environment, and since you can set Python 3 to be the first-class Python in Ubuntu (as in, you call python and you get Python 3), I wanted to do the same on the Mac I've ...
user avatar
  • 101
1 vote
1 answer
475 views

Homebrew PATH set in .zshenv is overridden

Following this answer about best practices for configuring Zsh, I wanted to move my Homebrew PATH initialization to the ~/.zshenv file: eval "$(/opt/homebrew/bin/brew shellenv)" This ...
user avatar
  • 267
1 vote
1 answer
17 views

ImageMagick Convert single frame = file not found

I am trying to extract the fist frame of a video convert ./video.mp4[0] ./sample.jpg I get file not found if I put [0] it works without [0] but this is not what I want All examples on the net suggest ...
user avatar
1 vote
0 answers
12 views

Mac Terminal changed from @username-MacBook-Pro to @username-MBP, why? [duplicate]

I was using my macOS terminal and I realised that after doing a factory reset my terminal name went from username@Username-MacBook-Pro to username@Username-MBP. Nothing else really changed but I want ...
user avatar
  • 11
0 votes
1 answer
106 views

zsh compinit errors

I have errors with the zsh shell: zsh compinit: insecure directories and files, run compaudit for list the files listed with errors are /usr/local/share/zsh/site-functions /usr/local/share/zsh /usr/...
user avatar
0 votes
0 answers
413 views

Can't add PATH entry for PHP to ~/.zshrc: "permission denied"

I have installed PHP 7.4 on my Mac using brew. Now I want to be able to have it in my PATH variable. I need to run: echo 'export PATH="/opt/homebrew/opt/php@7.4/bin:$PATH"' >> ~/.zshrc ...
user avatar
  • 1
2 votes
2 answers
110 views

Copy and Flatten directory contents with zsh

I have a directory tree, where each subdirectory contains several different filetypes, I want to copy one particular filetype from each of the subdirectory, but I need to flatten the results, so that ...
user avatar
0 votes
1 answer
94 views

Setting permanent environment variable [duplicate]

I want to set a permanent environment variable, I have used the .profile, .zshrc, .bash_profile, however, none have worked, after doing the command source .profile it works while I have the terminal ...
user avatar
0 votes
0 answers
37 views

ssh-agent running in x86 mode, not Apple Silicon, on M1 MacBook Pro

On my M1 MacBook, I'm trying to migrate as many apps and CLI utilities as I can from running the x86-based binaries to running the universal or ARM-based binaries for Apple Silicon. I noticed that ssh-...
user avatar
  • 243
0 votes
1 answer
103 views

What is changing my $PATH?

When I open a new Terminal, the $PATH is not what I set in .zshenv grep -i path .??* shows that no other dot-file sets the path. Adding a couple of echo, I see: Last login: Thu Nov 18 13:29:13 on ...
user avatar
  • 3,355
0 votes
1 answer
193 views

Is it a bug for zsh to run a quarantined script? [closed]

Update: I am not going to delete the question although it is useless. The answer is, Yes, it would be a bug, but zsh doesn’t do that. I screwed up writing the details. A quarantined script can be ...
user avatar
  • 3,355
1 vote
1 answer
140 views

zsh command substitution fails when assigned to LINES

Why does this fail for zsh? bash-3.2$ FILENAME="/Users/john/Desktop/hash.txt" bash-3.2$ LINES=$(cat $FILENAME) bash-3.2$ echo $LINES ccf09b34dd38f383ce0eb37efbda0bfc546bb562 ...
user avatar
  • 717
0 votes
1 answer
79 views

Apple Script can't find executables

Since moving to zsh from bash my previous AppleScript scripts can no longer find executables that are in my path, unless I use the full path to the executables. What can I do to keep using zsh and ...
user avatar
  • 717
2 votes
1 answer
329 views

Sort list of numbers using the zsh shell in Mac OS X

Using Mac OS X zsh shell, how can I ascending sort the following list of numbers? I have tried the command line sort (without any options) but the output is not accurate. The below list of numbers is ...
user avatar
-3 votes
1 answer
4k views

ZSH Killed my executable file in mac m1 while running the iOS project using script [closed]

ZSH Killed my executable file in mac m1 machine. I am using the mac m1 machine to run my iOS project. Here while running the app it gets killing my executable script in the m1 machine. I have fastlane,...
user avatar
  • 70

1
2 3 4 5 6