New answers tagged terminal
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
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,...
0
votes
Accepted
Why do I get `Bad file descriptor` when copying using hardlink flag?
This has been submitted as bug to Apple: FB13434700
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....
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 ...
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 ...
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
...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ./ ...
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" && ...
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 ...
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 ...
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.
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 ...
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 ...
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 ...
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
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:
# ...
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 ...
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.
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 &...
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 ...
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 ...
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
...
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 ...
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 ...
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&...
-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 ...
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&...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
Top 50 recent answers are included
Related Tags
terminal × 6497macos × 2737
command-line × 1123
bash × 987
finder × 400
applescript × 384
homebrew × 318
iterm × 285
mac × 280
ssh × 259
zsh × 247
keyboard × 239
network × 215
script × 189
permission × 185
automator × 176
macbook-pro × 165
unix × 159
python × 142
path × 129
catalina × 127
mojave × 115
disk-utility × 111
hard-drive × 104
sudo × 104