New answers tagged

0 votes

Set iTerm2 as the ssh:// URL handler

I use the following method to run a script that opens in iTerm2 open -a "iTerm 2" nonprod.sh
ziggy's user avatar
  • 101
0 votes

ssh: permissions in files /etc

I had same symptoms - problem ended up being duplicate entries at end of sshd_config due to duplicate installs of XQuartz (the only X11 available). Double check your sshd_config file. Host is Monterey,...
zslg01's user avatar
  • 1
0 votes
Accepted

Why do I get `Bad file descriptor` when copying using hardlink flag?

This has been submitted as bug to Apple: FB13434700
oligofren's user avatar
  • 362
0 votes

Failed Homebrew Installation

Taking your device to a couple networks would be prudent to be sure it's an issue on your macOS and not just transient network communication issues. This is the command to test: curl -I https://raw....
bmike's user avatar
  • 232k
0 votes

How do I download folders through FTP in Terminal?

lcd /dirtodownload prompt mget * From @Besi answer, was doing the job directory by directory, but I needed to download a large site via ftp. Wget options works with a tradtional ftp server, (unlike ...
Greggory Wiley's user avatar
0 votes

zsh can't see and doesn't load the ~/.zshrc startup file

In my case, the thing was hidden in the line To update your account to use zsh, please run chsh -s /bin/zsh. As I understood, the problem is in fact, that for any reason zsh was not a default shell ...
amricko0b's user avatar
0 votes

Create a playlist via command line?

Not sure if it's what you want, let me share you with my approach to play a playlist with command line Generate a songs.m3u file with code. .m3u is a file for playlist, which looks like this #EXTM3U ...
Alex G's user avatar
  • 101
3 votes

How to change default notification sound (tri-tone) for *all* apps (via Terminal preferably)?

The operating system is sealed so every check at boot would have to be relaxed security and every single macOS update it would get overwritten or fail. Assuming you got the modified OS to run, next ...
bmike's user avatar
  • 232k
0 votes

How to open new Terminal windows directly on active Desktop [not on Desktop with other terminal windows]

For the sake of answering my real problem, which was not completely explained it the original Question, but, imho, doesn't deserve a new one... Here is ChatGPT answer: To create a shortcut on a Mac ...
Myoch's user avatar
  • 394
0 votes
Accepted

How to open new Terminal windows directly on active Desktop [not on Desktop with other terminal windows]

This depends on one Mission Control Setting… "When switching to an application, switch to a Space with open windows for that application" When this is on every time you try to open a new ...
Tetsujin's user avatar
  • 114k
0 votes

How to turn off zsh save/restore session in Terminal.app

You may also be interested in: defaults write com.apple.Terminal NSQuitAlwaysKeepsWindows -bool false To prevent windows and tabs from reappearing. If you want it to take effect for all apps use ...
user12638282's user avatar
3 votes
Accepted

Why does iTerm no longer source ~/.bash_profile, but Mac Terminal does?

iTerm does not source your shell startup files. It is a terminal emulator, not a shell. The shell you run inside iTerm sources your shell startup files. Further, looking at the value of $SHELL is ...
Marc Wilson's user avatar
  • 5,587
1 vote

Apple Terminal startup errors (session save/restore)

I saw this today! Haven't seen it before. I'm on Monterey (12.7.1 21G920). I rebooted my MacBook today (not installing the update, just a normal reboot). After it restarted, I noticed that it didn't ...
Kuba Suder's user avatar
1 vote

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

According to the documentation, you can simply issue the second part after the pipe: code ./hello.c VSCode will create the file since it doesn’t exist and then open the newly created file. The ./ ...
bmike's user avatar
  • 232k
2 votes

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

The correct answer isn't an alias, aliases don't have arguments. They are text substitutions. Instead you want a small function, similar to this: function makefile { touch "$1" && ...
Marc Wilson's user avatar
  • 5,587
5 votes

How do I extract text from images in terminal?

I did this using Shortcuts on Mac OS, creating the following shortcut: Then executing the shortcut from the command line or a script: shortcuts run "extract_text_from_image" -i input.png -o ...
Todd W's user avatar
  • 151
0 votes

Weird message (MacOS 14): "-macosx_version_min has been renamed to -macos_version_min"

This is a change in Xcode 15. My answer is from a quick google and seeing other bug reports on this issue however I haven't looked in enough detail to say more than the line above but I think the ...
mmmmmm's user avatar
  • 29.8k
0 votes

MacBook Pro: How to open last terminal tabs on restart?

"Save Window Group" is a feature you can find in the Terminal menu.
silian-rail's user avatar
2 votes

How do I make the 'say -v PersonalVoice' command save output to a file?

It seems to be yet another Apple restriction rather than a bug. Although it notes in say's man page that not all voices are compatible with all audio configurations, I tried many of the system voices ...
Elias Limneos's user avatar
1 vote

How to get the fully resolved path of a symbolic link in Terminal?

The -f flag of readlink is introduced in macOS Monterey 12.3 1. So if you're using the version later than or equal to it, readlink -f can be used to get the fully resolved path. From the manpage of ...
catwith's user avatar
  • 387
0 votes
Accepted

Modify "Show on all Spaces" wallpaper setting by shell on macos Sonoma

So I did a bit of digging and macOS Sonoma seems to use a new .plist file for wallpaper/screensaver related things, located at ~/Library/Application Support/com.apple.wallpaper/Store/Index.plist. You ...
sumga13's user avatar
  • 16
1 vote

How can I list my open network ports with netstat?

As an alternative tool, you can try BSD look alike sockstat tool to show LISTENING sockets: https://github.com/mezantrop/sockstat
Mikhail Zakharov's user avatar
1 vote

How to delete (tmutil delete) all old backups from TimeMachine - keep only current full backup

macOS Sonoma Version 14.0 I have some problems with above bash code. This is my modified code that applies to me. #!/bin/bash # Assuming you have the backup disk connected & root privileges: # ...
Its5AM's user avatar
  • 11
0 votes

How to switch the keyboard input language from the terminal?

@Tom Gewecke in my case, I use three input language source (so I use Finnish, English and Russian keyboards). And I'm using something like punto switcher, but it can not detect differences between ...
Алексей's user avatar
0 votes

Fixing error: "The Trust Settings Record was corrupted."

Run /usr/bin/security dump-trust-settings -d and it will show the certificates that are causing the problem.
chrish's user avatar
  • 195
3 votes

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

You can use case-insensitive (-f) version sorting (-V) with sort: cd <your directory> while IFS= read -r -d $'\0' filename; do # <your command(s) accepting each filename here> printf &...
Aeronautix's user avatar
1 vote
Accepted

Why does softwareupdate stall in terminal after successful download?

I would restart and then observe if the update processed. If not, try softwareupdate -i -a --restart --agree-to-license You can dump the internal state at any time with softwareupdate --dump-state ...
bmike's user avatar
  • 232k
0 votes

How to start Tunnelblick VPN connection via Terminal

The simplest solution is to use tunblkctl. It's lightweight and gets the job done. You can quickly install it using Homebrew and then utilize it for various OpenVPN-related automation workflows on ...
Andrey's user avatar
  • 1
2 votes
Accepted

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

This will generate a sorted list similar to Finder's: lc() { REPLY=$REPLY:l } print -rl -- *(no+lc) Output: bar-2.jpg bar-10.jpg bar.jpg foo-1.jpg foo-2.jpg foo-10.jpg foo.jpg STA-3.jpg STA-20.jpg ...
Gairfowl's user avatar
  • 246
1 vote
Accepted

How do I access MacOS Sonoma Personal Voice from command line?

The "say" command works fine with personal voice, but it doesn't do the necessary tasks to request permissions to be granted to the Terminal app. The problem is that Mac OS Sonoma does not ...
Elias Limneos's user avatar
1 vote
Accepted

Terminal "history" command brings back different results

Try running history -a; history -n to: load commands from the history file that were added from other open shells append new commands from your current shell session to the history file This ...
luckman212's user avatar
  • 2,683
1 vote

How to launch TextMate (and probably other software) from the command line?

I guess they've made this easier recently. You can now install the "mate" command by going to... TextMate "Settings..." -> "Terminal" -> Click the "Install&...
Harry Wood's user avatar
-1 votes

How to turn off zsh save/restore session in Terminal.app

If you want to keep the session history and restauration processes without having the notifications, you can simply edit the configuration files. See my answer here [Adding this answer as there used ...
Hugues's user avatar
  • 491
0 votes

Difference in font rendering between iTerm and Terminal.app

Under the iTerm2 setting for Text Rendering, there are options for "Use thin strokes for anti-aliased text". On my machine, if I change from "On Retina Displays" to "Never&...
Bruce Van Allen's user avatar
1 vote

Check if display sleep on Apple Silicon in Bash

I wrote a small Objective-C program that may be helpful. It will return the current display sleep/wake status or the screen lock status via exit code (0=sleeping/locked, 1=awake/unlocked). Tiny ...
luckman212's user avatar
  • 2,683
0 votes

Check if display sleep on Apple Silicon in Bash

Ok, maybe I have found a solution. With Apple Silicon there isn't IOPowerManagement inside the IODisplayWrangler section. I had to look for the information in another way and I found system_profiler ...
Piero's user avatar
  • 121
0 votes

zsh compinit errors

I re-installed zsh-completions, and ran this as per the notes: Additionally, if you receive "zsh compinit: insecure directories" warnings when attempting to load these completions, you may ...
John Ko's user avatar
  • 41
2 votes

Apple Terminal startup errors (session save/restore)

Since I've been asked to do so in .zsh_sessions producing an error I post here the fact that commenting out the echo line did make the problem disappear in a similar case: I commented out the echo -ne ...
Hugues's user avatar
  • 491
1 vote
Accepted

User files ownership anomalies on MacOS 14.0

By default, macOS ignores ownership of files on volumes that are hosted on external storage devices (unless they're in use as a Time Machine backup destination.) To enable ownership, select the volume ...
Linc D.'s user avatar
  • 189
2 votes

Why do I get "operation not permitted" when I try to `ls` the content of Desktop on Mac OS?

It turns out that applications have an additional set of permissions over the user folders. I had to allow iTerm2 access to the Desktop folder: System Settings => Privacy & Security => Files ...
Marcello Romani's user avatar

Top 50 recent answers are included