Skip to main content

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
0 votes
1 answer
44 views

macOS Ventura unable to auto source custom terminal settings (~/.zprofile)

I have a custom .bashrc file with loads of aliases and custom functions which is all located in ~/.bashrc. In ~/.zprofile I added source ~/.bashrc. All my functions and alias work except for the ...
LogicalDeveloper's user avatar
1 vote
0 answers
51 views

How to type tilde (~) in Spanish keyboard in Terminal

I type option+ñ and get a ~ on most applications: when I am in Terminal, I get (arg: 1) on bash, and ? on zsh. The results are the same for left and right option keys. Hardware: MacBook Pro, 15 inch, ...
simona's user avatar
  • 223
1 vote
1 answer
50 views

How to bindkey page up/page down in macOS terminal?

When I open the Terminal and press the "page up" button it simply scrolls my Terminal screen one page up, so that I can see what I typed and what the executed commands outputs were earlier. ...
a_girl's user avatar
  • 175
2 votes
1 answer
60 views

after migrating to Arm CPU, zsh and oh-my-zsh plugins give `compint` warnings

I recently migrated from an Intel-based Macbook to an Arm-based Macbook. As part of the migration, I copied over files including my Homebrew installation. It turns out this has caused some issues and ...
Drew Dara-Abrams's user avatar
3 votes
3 answers
158 views

Reset default terminal directory Mac Ventura 13.6.7

I had previous changed the default directory my terminal opens up in to a specific sub folder in Documents no matter when or how you open a new terminal. I want to reset it back to the default ...
displayname's user avatar
1 vote
0 answers
56 views

Simple shell commands never finish, but only on external drive

Most of the time, my Mac's Terminal works great. However, when I use it to navigate the file system of my WD My Passport 1TB external drive, it... almost works. Almost. Simple commands like cd and ls ...
Photosynthetic's user avatar
2 votes
1 answer
220 views

zsh: argument list too long - How to increase the limit?

As mentioned here the argument size of a command is quite limited. That's when you get zsh: argument list too long. On my machine it seems to be $ sysctl kern.argmax ...
Sarien's user avatar
  • 181
1 vote
1 answer
70 views

How to find out what is changing my PATH?

OS: 14.4, shell: zsh, additional software: homebrew, vim, oh-my-zsh, iTerm2, et cetera One day I noticed that my PATH contains strange part: /opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/...
Nikki Chumakov's user avatar
2 votes
1 answer
93 views

How to control buffering for processes in terminal pipe? `stdbuf` doesn’t seem to work

I’m trying to use stdbuf to control buffering for a process in terminal — specifically, using stdbuf -o0 to prevent buffering when piping output onward, roughly as described in this answer — but it ...
PLL's user avatar
  • 997
1 vote
1 answer
146 views

Relaunch Terminal using a command

Today, to convert from Markdown to PDF using Pandoc, it was necessary to install pdflatex. I did brew install basictex and then it was necessary to relaunch Terminal. For this, I simply quitted it and ...
user avatar
1 vote
0 answers
72 views

$PROMPT $PS1 automatically set in zsh

I changed from bash to zsh on a mac upgrade and now cannot change my terminal settings. As I moved from an old to new machine, which inherited the old settings. Opening a new terminal gives: Last ...
Chris Wyatt's user avatar
0 votes
2 answers
52 views

Bash / ZSH script that can be run as one click exe/app for other Mac users

I have a bash script and the only way I get others to run it is by sharing the code to them or asking them to open the terminal and then do "bash filename.sh". Instead of this, I would like ...
Drake's user avatar
  • 1
1 vote
0 answers
53 views

How to output the real-time logs of a shell script in Mac's Shortcut app?

I am trying to create a shortcut for Datastax (for Cassandra). Datastax requires the execution of a shell script viz. server.sh to get the server started. I am trying to create a "Run Shell ...
Soumav's user avatar
  • 111
0 votes
1 answer
74 views

Oh My Zsh + iterm2 - Wrong characters showing

I'm using the iterm2 with omz - version "master (130002a)". From the last update versions, it's started to show strange characters. I've already tried to set different fonts, etc., and also ...
ldpereira's user avatar
0 votes
2 answers
82 views

Get current_path if using AppleScript as osascript expression

I have a following AppleScript: tell application "Finder" set current_path to container of (path to me) as string duplicate file (current_path & "foo.txt") end tell It ...
user avatar
4 votes
2 answers
480 views

To copy a file and preserve its comment

Is it possible to copy an individual file and preserve its comment? Here is what I have tried. Nothing here works for me on macOS 14.3.1 and Zsh 5.9 (x86_64-apple-darwin23.0). cp file.txt file-copy....
user avatar
0 votes
1 answer
58 views

ls -g: 'man ls' says -g option has no effect, but it works

macOS 14.3, zsh 5.9 (x86_64-apple-darwin23.0). man ls: -g: This option has no effect. It is only available for compatibility with 4.3BSD, where it was used to display the group name in the long (-l) ...
user avatar
2 votes
1 answer
77 views

cp, trailing slash, and copying to the same vs. to another directory

To copy a directory to another directory, the first directory should be written without the trailing slash: # example 1 # this command will copy dir1 to dir2 # (dir2 is preexisting) cp -Rip dir1 dir2/ ...
user avatar
1 vote
1 answer
53 views

zsh: To understand spaces

This is a one-line bash script by Ishmael Smyrnow to clear macOS icon cache: sudo rm -rfv /Library/Caches/com.apple.iconservices.store; sudo find /private/var/folders/ \( -name com.apple.dock....
user avatar
1 vote
2 answers
292 views

Problems with Python on macos Ventura

So I updated my mac a while ago to ventura 13.3.1 and ever since it messed up my python path, I can't use Pycharm (it can't locate a valid interpreter path), and I can't use pip as well. When I try to ...
ClovisIRex's user avatar
0 votes
1 answer
242 views

How did my hostname change? Where can I see this change being made/what time it changed? [duplicate]

today I logged into my mac and opened zsh and had a big shock! Normally my terminal prompt is something like: sidharthghoshal@macbook-pro But today I found it was : sidharthghoshal@HaeLims-Air I don't ...
Sidharth Ghoshal's user avatar
5 votes
1 answer
1k views

Difference between cp and cp -rf

Could anybody explain is there any difference between cp some-file.txt some-folder and cp -rf some-file.txt some-folder on a Mac? I was told that cp -rf forces cp to overwrite existing files, but it ...
user avatar
2 votes
1 answer
78 views

How to move strings contained in results of `nettop` using text editor?

using sed, awk, ed, etc... how to save an output string into a variable and print in a different position? example output of nettop: iMac191 ~ nettop -l1 -n -J interface,state -p "$(/usr/bin/...
John's user avatar
  • 1,071
0 votes
2 answers
66 views

How to edit a binary executable CLI tool with a hex editor and still run it?

I'd like to edit a binary executable CLI tool with a hex editor, and still be able to run it afterwards. Currently, when I edit the file and then run it, I get "zsh: killed [cli tool]". The ...
Duane J's user avatar
  • 111
7 votes
4 answers
2k views

How to prevent accidental execution of potentially harmful commands (e.g. reboot)

I spend a lot of time in Terminal.app, and in iTerm2 - mostly using SSH connections to some Linux boxes. I'm used to issuing reboot commands to these Linux boxes, but earlier this evening I ...
Seamus's user avatar
  • 4,752
1 vote
0 answers
36 views

Terminal: can I configure the OPEN command to associate specific file extensions/types with specified applications? [duplicate]

Basically the full question is in the title already: can I configure the OPEN command to associate specific file extensions/types with specified applications?
Richard Kranendonk's user avatar
1 vote
2 answers
76 views

strange issue with aliases for zsh

I'm trying to create an alias in my .zshrc file for an SSH connection. The full command is this: ssh -t pi@raspi5 "cd ~/C-progs/c_trials; exec \$SHELL -l" The command is designed to open an ...
Seamus's user avatar
  • 4,752
2 votes
1 answer
73 views

Why can't I install oh-my-zsh to a Mac in China?

I am in China, my Mac OS is macOS Ventura 13.6.4 I used the Terminal to input: sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" but the output is : curl:...
john xie's user avatar
0 votes
0 answers
224 views

After running `brew upgrade` in macOS 14.3, I got this error while installing numpy: 'Error: The `brew link` step did not complete successfully...'

The full error message is: ==> Pouring numpy--1.26.3.arm64_sonoma.bottle.1.tar.gz Error: The `brew link` step did not complete successfully The formula built, but is not symlinked into /opt/...
clarkb86's user avatar
  • 131
0 votes
1 answer
43 views

Can I remove % from a $PATH definition in zsh?

issue: ping is not found: zsh: command not found: ping /sbin/ping -c 3 192.168.1.114 returns the expected result echo $PATH returns: /Users/user/Scripts:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin% ...
gatorback's user avatar
  • 3,081
0 votes
0 answers
90 views

Issues with zsh permissions on my mac m1

I am trying to install kubectl on my macOS using this link But in the final step when I go on to check 'kubectl version --client ', I get the error zsh: permission denied: kubectl I cannot understand ...
Elvis's user avatar
  • 1
0 votes
0 answers
198 views

Make zsh tab completion like bash

I don't have self-confidence in using term "completion". I just want to make zsh behavior like bash. (See uploaded gif) As this gif image shows, bash can complete path of the file by ...
xanadu6291's user avatar
2 votes
1 answer
252 views

MACHTYPE environment variable on ARM

I am on an M3 Pro, MacOS 14.2. When I try echo $MACHTYPE (in a default -zsh shell) the output is x86_64, whereas uname -mp returns arm64 arm. Zsh docs say that MACHTYPE should be "the machine ...
shea's user avatar
  • 177
0 votes
0 answers
183 views

Long delays before executing shell commands

I'm using a MacBook Pro 15-inch (2017), macOS Ventura 13.6.3. When I try to run a command, any command, in a shell, there will often be a delay before the command starts, usually on the order of ...
Chad Groft's user avatar
3 votes
1 answer
3k views

In Mac OS Sonoma, 'Permission denied' when trying to create a file in the home directory

I'm on the latest Sonoma 14.2 and when in my user's home directory I cannot create a file. I have checked the rights and it looks okay. Sudo works but this is my home directory and it messes with me ...
fredrik's user avatar
  • 133
0 votes
0 answers
75 views

zsh:killed command grep -q -Fx "$zcompdump_revision" "$ZSH_COMPDUMP" 2> /dev/null

This issue started occurring randomly yesterday and I cannot figure this out. Every time I launch zsh, I get the error mentioned below: zsh: killed command grep -q -Fx "$zcompdump_revision&...
arximughal's user avatar
0 votes
0 answers
445 views

iterm2 command history

I like the iterm2 command history which can be triggered by command+shift+;. However, I observation is it does not have the whole history that I can get from the history command. For example, I ...
Bomin's user avatar
  • 101
2 votes
2 answers
77 views

Terminal | Shortcut for Automatically Saving Files Created Using "code"

I have a question regarding a shortcut use of "code". My Goal is to simultaneously: Open a new file in VS Code, and also: Automatically save that new file to my current working directory ...
Drew P's user avatar
  • 21
1 vote
2 answers
173 views

zsh - Sort files expansion in MacOS Terminal like in Finder: numerically and case-insensitively

Is it possible in MacOS Terminal to have the sort order numerically and case-insensitively, almost like in Finder? I'm on MacOS 14 Sonoma, using Terminal app with zsh 5.9 and oh-my-zsh. I'm trying to ...
Dmitrii Kuznetsov's user avatar
0 votes
0 answers
133 views

I tried $arch -x86_64 zsh and receive arch: posix_spawnp: zsh: Bad CPU type in executable

~ arch -x86_64 zsh arch: posix_spawnp: zsh: Bad CPU type in executable ~ Rosseta of course installed. I tried everything and Googled everything. What should I do?
Lutogin Andrey's user avatar
2 votes
2 answers
175 views

Risk of uninstalling a customised zsh version

Having been confronted to a minor bug on Apple Terminal, I followed naively an advice on an internet website recommending to update my shell zsh to latest version, using brew. Which I did. (and it did ...
Hugues's user avatar
  • 555
3 votes
0 answers
148 views

.zsh_sessions producing an error [duplicate]

Each time I open Terminal, I get an error: /Users/myname/.zsh_sessions/SESSIONID.session:2: command not found: Saving in each of the windows I set to open by default. This seems to have appeared a ...
Hugues's user avatar
  • 555
1 vote
0 answers
187 views

How to turn off zsh automatically restore session in Terminal.app

This question is related to How to turn off zsh save/restore session in Terminal.app. However, I don't want to shut down sessions completely setting SHELL_SESSIONS_DISABLE=1 in my .zshenv. I want to ...
gernophil's user avatar
  • 349
1 vote
1 answer
2k views

Homebrew not installing correctly

I was installing homebrew through the .pkg to install GNU Emacs, and it did not run after installation. I ran brew help and it outputted zsh: command not found: brew. Command Line Developer Tools were ...
Average Terminal User's user avatar
0 votes
0 answers
64 views

MacOS Warning on Terminal Startup: "Warning: No available formula with the name "pure#". Did you mean pure?"

I recently tried to install a zsh prompt called pure, where I followed the instructions listed on its Github page https://github.com/sindresorhus/pure I set my ZSH_THEME = "", ran brew ...
Om Patel's user avatar
0 votes
1 answer
61 views

Misleading diagnostic message

I generally use /tmp/tmp for throwaway files, but when I accidentally missed the slash, I got: WGroleau@MBP ~ % find /Users -name "Cami*x" -print > /tmptmp zsh: read-only file system: /...
WGroleau's user avatar
  • 5,065
1 vote
1 answer
454 views

Trying to read xattr values on multiple files

In trying to read all the values of the extended attributes on a single file, if I do xattr -l <filename> | while read ATTR; do xattr -p $ATTR <filename> done I get what I expect.  But ...
WGroleau's user avatar
  • 5,065
0 votes
0 answers
52 views

What is this zsh file generated unintentionally every time I use zsh

The file name is zsh.<computer_name>.local.<random_numbers>. In this case it is zsh.macbook.local.754. It started appearing after I moved all zsh files in the home directory to ~/dotfiles/...
circular_reference's user avatar
7 votes
3 answers
1k views

Terminal: How to move files to the last used directory conveniently?

I googled to no avail and could not find any example. For example, if I want to move files to the current dir I can use . But what if I am in ~/foo and cd into ~/foo/bar/xyz/dir and want to move, say, ...
mariano-daniel's user avatar
1 vote
1 answer
2k views

Is there a way to jump within a word using option with arrow keys in iterm2

What is the issue? I have been using the ⌥ + → & ⌥ + ← shortcuts to navigate between words, along with ⌘ + → & ⌘ + ← shortcuts to navigate to the end / beginning of the line in iTerm2. It ...
Kiran's user avatar
  • 123

1
2 3 4 5
10