All Questions
Tagged with cli or command-line
3,346 questions
0
votes
0
answers
5
views
How to set up Logwatch configuration overrides?
I've been running Logwatch on a Raspberry Pi for some time and learned a lot from it. I decided to install on a Mac (Intel iMac running Sequoia) via MacPorts.
The Logwatch configuration file
/opt/...
0
votes
1
answer
31
views
df difference in output of -H and -h
When I do a df -H ., the free space is displayed as, i.e., 7.1G. If I do a df -h ., it shows as 6.6Gi. I think the difference in the numbers stems from the fact is that the latter assumes 1 GB as ...
0
votes
1
answer
43
views
Does `open --arch ARCH` working on the wrong processor mean an ARM emulator is present for Intel machines running macOS?
From man open:
--arch ARCH
Launch with the given cpu architecture type and subtype; ARCH should be one of
any, arm, arm64, arm64e, arm64_32, x86_64, x86_64h, i386. Two integers
...
0
votes
2
answers
49
views
On my Intel Mac, I upgraded brew and cannot use Terminal anymore
Sadly, I exited the Terminal session I used so I cannot show the update information. The symptom I have now is that Terminal starts and instantly exits leaving no trace as to why it exited. I replaced ...
2
votes
2
answers
91
views
How can I get the locate command to search into my home folder?
The locate command doesn't list any search results from files that are in the hierarchy of my home folder. Is there a config file to tweak to enable this behavior?
I've tried:
sudo locate word
sudo /...
1
vote
1
answer
39
views
Tor shows running on both port 9050 and 9150, but torsocks doesn't seem to be working at all
I'm on a device where certain hostnames are blocked at an operating system level, so even If I go to a different network, the hostnames are blocked as well. This is also the case for using command-...
1
vote
1
answer
77
views
Weird long numbers in terminal prompt and mail headers
In macOS (Sonoma 14.6) my shell sometimes shows odd and long numbers inside the prompt instead of my host name for my Mac :
Changing either the shell from zsh to bash (chsh -s /bin/...) and opening a ...
2
votes
1
answer
134
views
Running `ps -t /dev/<tty>` started causing the specified terminal to stop receiving most keystrokes
Specific Problem
Running ps -t /dev/<tty> recently started causing the associated terminal to stop receiving some keystrokes. I can't fathom why this started happening now, without any software ...
7
votes
2
answers
786
views
Is there any way to grep a binary plist?
When working in a terminal, I want to use grep on a binary plist file. Is there any command or utility that will print the contents of a binary plist to stdout so that I can grep through it?
0
votes
2
answers
30
views
iCloud drive shows in Finder only files where I created a shared link
This is on MacOS Sequoia.
Until yesterday, I could see all my iCloud files from within Finder.
Today I messed this up in the following way: I wanted to do something on the command line with a certain ...
0
votes
2
answers
66
views
How to tell iterm2 to use emacs mode, not vi mode
I've recently switched from Hyper terminal (no longer maintained) to iterm2.
I'm surprised that iterm2 seems to be using vi mode: instead of going to start and end of line when I press ctrl+a/ctrl+e ...
0
votes
1
answer
36
views
AppleScript that reduces the size of multiple PDF files fails
macOS Sierra Version 10.12.6.
Script-editor Version 2.9 (191).
I'm trying to reduce the size of multiple PDF files, however the script below exits wth this error: line ending expected, but class name ...
0
votes
1
answer
75
views
Can't modify Info.plist (Operation not permitted)
% sudo cp /tmp/Info.plist .
Password:
cp: ./Info.plist: Operation not permitted
% pwd
/Applications/Xcode-15.4.app/Contents
% ls -@ledO . Info.plist
drwxr-xr-x 18 antontropashko staff - 576 ...
0
votes
1
answer
17
views
There is no --lesskey-file option / there is no -k option [duplicate]
Using default macOS less (/usr/bin/less), man less and less --help both show that less has the option
-k [file] . --lesskey-file=[file]
Use a lesskey file.
But no matter how I ...
0
votes
1
answer
36
views
Getting number of performance cores and efficiency cores of MacBook Pro in Terminal
The number of performance and efficiency cores differs wildly between all the variants of the Apple silicon M cpus and Apple usually does not list these even in the technical specs.
Is there a way to ...
0
votes
0
answers
31
views
"gpt recover: operation not permitted: recover" when trying to recover an external HD using "sudo gpt recover /dev/disk"
I plugged in an old WD My Passport external HD (WDBACX0010BBK-00) into my 2020 Macbook Air M1 on Sonoma 14.5, only to find that the disk does not show up on finder. Disk utility shows a WD Virtual CD ...
1
vote
1
answer
35
views
How to install sk1 on macOS?
I want to try sk1 as a graphic design app. I found the GitHub repository for macOS, cloned it, and follow the steps mentioned in the sibling directory for Linux to install:
git clone https://github....
2
votes
1
answer
52
views
Code works in ScriptEditor but not with osascript
I'm confused about what's going wrong here.
I have this code
let Calendar = Application('Calendar');
console.log('Here #1');
console.log(Calendar.calendars.length);
console.log('Here #2');
If I run ...
2
votes
1
answer
67
views
Copy or move files using Finder, but from Terminal
To copy or move file to a different folder using Terminal, the obvious way is to use the cp and mv commands.
But for users who often put important information in the "Comments" section of ...
0
votes
2
answers
44
views
How to open a QuickLook preview of a file that isn't saved to disk?
You can use
qlmanage -p ~/Downloads/myimage.png
To open the QuickLook preview of myimage.png from Terminal.
Can you QuickLook preview an image coming from another program's stdout?
For example, I ...
1
vote
2
answers
142
views
Use Apple's FileMerge from command line and have it wait instead of exiting immediately
This question is a follow-up to Open two files for comparison in FileMerge, from command line.
After installing XCode, I can run opendiff dir1 dir2 on my Mac and get a nice GUI for comparing the dirs.
...
1
vote
1
answer
133
views
Is there a way to change installation directory of brew cask applications?
I don't have write access to the system wide application folder on my MacBook, so I want to be able to install cask packages to my user application folder. Is this possible with homebrew?
0
votes
1
answer
34
views
command about find for delete file or folder application
I can use command list below to delete files or folders, but would it be deleted directly, not in the trash? Is there parameter which is for delete file directly?
find / -name .DS_Store -exec rm {} +
...
1
vote
0
answers
141
views
How to remove this warning "lsof: WARNING: can't stat() apfs file system"
At some point in the last few days I am getting an lsof warning for a shell script that's been running every 60 seconds for over a year and has never returned this warning before. The only things I ...
3
votes
3
answers
212
views
Some programs report "no route to host" connecting to servers when run without sudo
On my Windows 11 machine, at 10.204.221.106, I'm running a netcat listener:
ncat.exe -lv 31415
On macOS Sequoia 15.0.1, I can successfully connect to the Windows machine with nc like this:
(base) ...
0
votes
2
answers
60
views
How do I record the memory usage of a process in macOS Sonoma?
MacOS: Sonoma 14.6.1
I have a C++ program I have developed on my Mac and that I typically run from the command line. Depending on certain runtime parameters that I set, the program can run from ~10 ...
1
vote
1
answer
30
views
Replacement for /usr/bin/logger?
I am looking for a replacement for good old logger which is adapted to the new macOS logging. It should which read from stdin.
Especially I want to set a kind of tag to more easily filter output later ...
0
votes
0
answers
74
views
How to create a bootable ISO file from a .tar.gz on macOS?
I want to use Arch Linux in a VM (I use UTM, which uses QEMU under the hood). Because I'm have an M1 Mac, I need Arch Linux ARM. Unfortunately, there's no installation ISO for Arch Linux ARM like ...
4
votes
2
answers
972
views
No route to host on iterm2 only
For some unexplained reason, iterm2 cannot connect to (at least some) devices on my local host. I get:
ssh: connect to host 192.168.252.248 port 22: No route to host
Initially I thought this was ...
3
votes
1
answer
186
views
How can I enable the Touch ID prompt instead of system password for sudo when other apps allow touch?
I'm running a fresh install of Sequoia, currently a macOS Sequoia 15.0.1 arm64 on MacBook Pro (14-inch, 2021) with Touch ID.
I tried to enable Touch ID for sudo and the config files now look like:
cat ...
1
vote
1
answer
73
views
Why is “where $HOME” showing as not found?
When I type where $HOME in terminal I get the following error:
/Users/juliapak not found
echo $HOME seems to work, but why do I have hidden files?
juliapak@julias-MacBook-Air ~ % where $HOME
/Users/...
0
votes
0
answers
33
views
Trying to free up space from my mac os, especially the others sector [duplicate]
Emptied the Trash
sudo rm -rf ~/.Trash/*
Removed System and User Cache Files
sudo rm -rf /Library/Caches/*
rm -rf ~/Library/Caches/*/
Removed System and User Log Files
sudo rm -rf /Library/Logs/*
...
4
votes
2
answers
589
views
Access clipboard contents from the command line
I want to explore rather than access the contents of the pasteboard/clipboard from the command line interface. I want to know whether there's something in it or what is in it.
For instance, if there's ...
0
votes
0
answers
103
views
.zprofile not used correctly after High Sierra
I am a Unix user and have been using zsh for more than 20 years.
I have been using zsh as my login shell for many years on macOS High Sierra.
I use only ~/.zprofile and for sharing what is relevant to ...
2
votes
0
answers
45
views
Command for installing macOS updates without entering password afterwards?
I looked at the softwareupdate command, but even after entering my password for sudo on sudo softwareupdate -aiR, softwareupdate itself asks for my password, so I have to enter it twice. I would like ...
5
votes
4
answers
2k
views
Why does using “.local” version of a machine name “fix” SSH which seems to have been broken by Sequoia?
“Fifteen” is the name of the machine (MacBook Air M2) and “Sellotape” is a 2019 iMac. Both running Sequoia.
Before Sequoia I was able to log in to either machine from the other. Now it fails:
Fifteen:~...
5
votes
3
answers
947
views
In a shell script, how do I wait for a volume to be available?
This gives an error that file_on_volume_foo.txt is not available:
open /path/foo.dmg
open /Volumes/foo/file_on_volume_foo.txt
The file ... does not exist.
0
votes
1
answer
22
views
How to get the status of ipv6 off/on using networksetup?
Based on previous research, I created the following two Bash aliases to turn ipv6 off and on:
alias ipv6off="networksetup -setv6off 'USB 10/100/1000 LAN'"
alias ipv6on="networksetup -...
0
votes
0
answers
25
views
Strange $HOST showing in iTerm [duplicate]
I am running macOS 14.5 on an M2 Macbook Air, and use ZSH for my shell environment with iTerm2.
I have a guest staying with me (let's call him Ricardo), who only has an iPad here. When I opened up ...
0
votes
0
answers
52
views
Would like to learn how to restore APFS SSD's that have been corrupted
I have three or four Samsung 860 SSD drives, with APFS containers that have gotten corrupted in one way or another (by my efforts to load linux, or to do other things).
It appears that I need to learn ...
0
votes
0
answers
13
views
Update Dock app icon cache without killall-ing it
I have a sheel script that changes the icon of an app by modifying the .../Contents/Resources/app.icns file, then touch /Applications/App.app so that the change is visible in the Finder.
But for this ...
0
votes
0
answers
44
views
Get Bluetooth mouse name from command line
I have a shell script that I run periodically to notify me if my Magic Mouse battery is running low (the built-in notification doesn't allow you to customize the threshold, which I find is too low). ...
2
votes
1
answer
128
views
What is the simplest way to detect internet connectivity on macOS with a script?
I know I can use ping or nc, but macOS itself must be storing the state of internet connection somewhere right?
For example, when you connect to Wifi, with no internet, macOS gives an indication (in ...
1
vote
0
answers
374
views
ClamAV configuration: failed to open log file /var/log/freshclam.log
I use ClamAV on Monterey.
Previously installed it using Homebrew, and so far it works OK, like sudo freshclam to update the signature database, or clamscan to scan an USB disk.
Now I switched to ...
1
vote
1
answer
78
views
How to suppress standard output when using `osascript` to type a keystroke
I'm planning to create an AppleScript script to "type" a string on the command line, but my script:
cmd="echo 'abc'"
osascript -e "tell application \"System Events\" ...
1
vote
0
answers
24
views
Is there anyway to add a note/alias to each IP in macOS Terminal New Remote Connection?
In macOS terminal.app, I can add remote SSH servers by IP addresses and ports. Can I add nicknames/aliases to each server so that I don't have to remember them (IP_Port->Corresponding Server) in my ...
2
votes
0
answers
85
views
Changing `locate` configuration so it indexes files in my home directory [duplicate]
I am the sole user of my macOS system (currently a Mac Mini M4 running macOS 15.1.1 Sequoia).
I would like to know if it's possible to (re)configure the builtin locate command and database to include ...
1
vote
1
answer
462
views
Touch ID for sudo on macOS 15 Sequoia
Does the usual auth sufficient pam_tid.so in /etc/pam.d/sudo or /etc/pam.d/sudo_local work on macOS 15 Sequoia (e.g. as described in this question)? I upgraded yesterday and went to re-apply ...
9
votes
4
answers
1k
views
networksetup -getairportnetwork return You are not associated with an AirPort network
I’m trying to retrieve the name of my Wi-Fi network via the terminal, but I’m encountering some issues.
I tried with the command:
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/...
0
votes
0
answers
38
views
What is /usr/local/bin/crpdspt?
I have a binary called crpdspt located at /usr/local/bin/. Google search provides really little results. It has a plist at /Library/LaunchDaemons/.
Any idea what that is?