Questions tagged [command-line]

Using programs and commands that do not have a graphical user interface (GUI) but are rather controlled by typing text commands into a terminal program, or shell.

Filter by
Sorted by
Tagged with
0 votes
1 answer
301 views

Proxy configured through .pac file behind enterprise VPN doesn't apply to CURL (terminal) commands

I can make a request to https://www.google.com in the browser behind VPN but when I curl that, it doesn't work. But if I disable VPN and do a curl https://www.google.com it will send a response. With ...
user avatar
  • 103
0 votes
1 answer
77 views

Running sudo with a specific shell

Suppose the default shell for root is sh, my default shell is zsh, but I want to run a command in csh with sudo. How? According to man sudo, -l will give zsh (my shell). -i can give me csh, but only ...
user avatar
  • 3,428
1 vote
2 answers
87 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,428
2 votes
0 answers
176 views

macOS Focus: How to allow notifications from commandline apps

I use a small utility to notify me when a commandline application finishes (in this case https://github.com/variadico/noti, but there are various solutions for this). I also use the new Focus modes. ...
user avatar
  • 121
0 votes
0 answers
19 views

Virtual Audio Device from audio file

I'm looking for a software (ideally a CLI tool) which creates a virtual audio device and plays an audio file (as a loop) as the input of this audio device. The reason I would need something like this, ...
user avatar
4 votes
1 answer
8k views

How can I get the CPU temperature from the command line on Apple Silicon M1

I wanted to monitor handy temperature data like I did dozen times on Linux machines. No problem! I found a beautiful one-liner: sudo powermetrics --samplers smc | grep -i "CPU die temperature&...
user avatar
  • 149
5 votes
1 answer
521 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
-2 votes
2 answers
120 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,428
1 vote
0 answers
509 views

Where is the log file for a Terminal session?

In Terminal.app I am running zsh. I need to diagnose what went wrong when I ran a bash shell command from Terminal.app. How do I find the log file for that?
user avatar
  • 165
3 votes
2 answers
513 views

Equivalent of AppleScript "with administrator privileges" in shell

Recently I have had to make some changes on my Macbook that required me to not only have just sudo privileges but root privileges. When I searched how to do this the answer which seemed most ...
user avatar
  • 31
0 votes
0 answers
75 views

Perlbrew install perl-5.34.0 fails with compilation errors on Monterey

I'm trying to use perlbrew to upgrade from perl 5.26 to 5.34 on Monterey MacOS 12.1 on an M1 MBAir. The installation fails due to 3 errors, all similar to this: util.c:2516:30: error: implicit ...
user avatar
  • 1,080
2 votes
1 answer
107 views

plutil directory Value (null) not valid for key path

I'm trying to create a plist but getting the error: Value (null) not valid for key path Architectures.com.apple /usr/bin/plutil -insert "Architectures" -dictionary /Users/test/com.apple....
user avatar
1 vote
1 answer
202 views

Find trust setting of a login keychain using cmd

Is there a way to find the trust settings of a certificate in login keychain using command line I tried this security dump-trust-settings -d. But this only returns for the System Keychain Also when i ...
user avatar
1 vote
0 answers
97 views

How to scale app menu bar to fit below built-in camera via Terminal

To make the menu bar for an application appear below the notch for an application, one can right-click the application, click Get Info, and check the 'Scale to fit below built-in camera' checkbox as ...
user avatar
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
186 views

How to know what the different `roles` do in `diskutil apfs` shell command

I wish to know what these mean, which one I should use, when specifying the <roles> as shown here. $diskutil apfs addVolume Usage: diskutil apfs addVolume <containerRefDisk> <fs> &...
user avatar
3 votes
1 answer
1k 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
0 votes
0 answers
301 views

Mac Not Sleeping In Clamshell "PreventUserIdleSystemSleep"

Whenever I put my mac in clamshell mode, it doesn't sleep. I've tried resetting: Reset NVRAM or PRAM Prevent Sleep Tab on Activity Monitor Removed Automatic Log in Applications & Extensions ...
user avatar
  • 1
3 votes
1 answer
90 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
  • 183
1 vote
0 answers
129 views

Enable multithreaded BLAS/LAPACK in NumPy @ macOS BigSur 12.1

I would like to enable a multithreaded BLAS/LAPACK backend for Python's (v3.9.9) NumPy on my macOS BigSur (v12.1). When I run my NumPy code, I see in htop, that only one python process is running and ...
user avatar
  • 131
1 vote
2 answers
494 views

Is there an alternative to whiptail for macOS?

I would like to try out a shell script that makes use of whiptail, but I am on a MAC and whiptail doesn't seem to exist there. Does anyone know if there exists a drop-in alternative (like, for example ...
user avatar
  • 121
3 votes
1 answer
203 views

How do I get mdfind to look in /opt?

mdfind does not seem to find files in /opt. e.g. $ mdfind -onlyin /opt -name Dockerfile $ find produces the expected result $ find /opt -name Dockerfile /opt/homebrew/Dockerfile /opt/homebrew/Cellar/...
user avatar
  • 201
0 votes
1 answer
52 views

Restore session (reopen windows) after a **CLI** shutdown on Big Sur

I'm automating some tasks, like brew upgrade then shutdown, or Duplicati backup (no Time Machine), wait for cloud sync then shutdown, but I can't seem to find a CLI command which WILL reopen my ...
user avatar
0 votes
0 answers
27 views

Delete Oldest Files Until Free Space Threshold Is Met

I'd like to keep a minimum of 50GB free on a drive. What command can I run that will delete my oldest files and stop once the 50GB threshold is met? I'm guessing some combo of du and rm but have no ...
user avatar
  • 53
1 vote
1 answer
2k views

If the new MBPs (M1) come with Python3 pre-installed, why don’t Python scripts run in shell?

I've been reading through lots of "how to"s on using Homebrew to install Python3 and Python packages, but from my terminal queries, it looks to me that Python3 is already installed: MBP21:~$ ...
user avatar
  • 233
1 vote
0 answers
69 views

Is there a tool (built-in or not) to parse `launchctl list` output to get one string?

I want to run a script based on one line in launchctl list output. I know there are ways to simplify this output using awk sed grep etc. The question is, is there a native or non-native tool for ...
user avatar
  • 737
1 vote
1 answer
500 views

'/usr/local/bin/curl' and '/usr/local/bin/ssh' commands are killed when executed in macOS Monterey [closed]

I recently updated my M1 MacBook Air to macOS Monterey (I'm not sure if this is related to the problem though), and now my curl and ssh commands in /usr/local/bin don't function at all. Both commands ...
user avatar
  • 11
1 vote
1 answer
144 views

How to delete line 7 in a file in Bash with sed?

How to delete line 7 in a file in Bash? I tried $ sed -i '7d' ~/demo error:sed: 1: "~/demo": command a expects \ followed by text
user avatar
  • 21
3 votes
1 answer
862 views

permission denied to add current directory to path

I am trying to install NGC CLI on company's Mac following the instructions given here. https://ngc.nvidia.com/setup/installers/cli When I try to run the third command there, which is echo "export ...
user avatar
4 votes
1 answer
211 views

Programs don't show up in jobs if I start them in the background with a shell script

I want to launch a three programs (2x streamlit, 1x python) in the background with a shell script: #!/bin/sh cd /Users/mc/src/crypto/ || exit streamlit run dashboard.py & streamlit run ...
user avatar
  • 143
0 votes
0 answers
11 views

Difference in permissions between executing a .app double clicking in finder, using 'open -a' in terminal, and './application.app/.../executable'

I have created a bundle application that uses temp files inside of a folder, a third party library takes care of creating temp files, using them and remove them. The folder containing the temporary ...
user avatar
2 votes
1 answer
674 views

MacOS >11.0: Is there a way to programmatically give an app Privacy->Accessibility Permissions?

Using only a command line, is it possible to add an app to Security & Privacy/Privacy/Accessibility shown below? Using Azure Pipelines, I'm attempting to set up a remote machine and it needs a ...
user avatar
0 votes
0 answers
115 views

Macbook pro still turn on when lid is opened after changing AutoBoot variable

I recently bought my first macbook, and I want it to not turn on when I open the lid. Searching online, the solution is by using % sudo nvram AutoBoot=%00 But this doesn't work for me. I'm on macOS ...
user avatar
2 votes
1 answer
1k views

Updated MacPorts curl implementation behaves differently from previous version and macOS curl

I am having an issue with the mac ports implementation of curl. mbp2016:~ pgee$ which curl /opt/local/bin/curl mbp2016:~ pgee$ curl --version curl 7.80.0 (x86_64-apple-darwin21.1.0) libcurl/7.80.0 ...
user avatar
  • 195
0 votes
1 answer
82 views

Getting extra character when copy string to iTerm

I'm using iTerm and when when pasting some string I've just copied from the terminal command prompt, I get some extra characters on prefix and suffix that match 00~ and 01~ respectively. I.e. I've ...
user avatar
  • 493
-1 votes
1 answer
436 views

How to connect to SMB server through terminal?

I need the equivalent of Ubuntu's smbclient to connect to a SMB server's resources and disconnect. I do not need mounting.
user avatar
1 vote
1 answer
49 views

What is the Bash DEFAULTS "domain" for changing [accessibility > display > colour Filters > tint]?

I want to write some bash-scripts that change for me system settings like: accessibility > display > colour Filters > tint What's in general the best way to find that "domain" (...
user avatar
0 votes
1 answer
3k views

Factory reset from terminal

I am wondering if there is a way to trigger a factory reset with terminal. My osx install is damaged after some disk operations and now I can't charge the laptop. It will die soon. I have tried ...
user avatar
15 votes
3 answers
2k views

What are the downsides of putting GNU coreutills first in ${PATH}?

I'm coming from Linux to macOS, and many of my scripts assume GNU versions of the utils provided in GNU coreutils. I could just put the GNU coreutils bin directory in earlier in $PATH than /bin. Is ...
user avatar
  • 281
0 votes
1 answer
1k views

imagick.so.so after brew update + php.ini "imagick.so" instead of imagick.so

I did a brew upgrade I have php 8.1 on osx 12.x Imagick is not working PHP Warning: PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/local/lib/php/pecl/20210902/imagick.so (...
user avatar
3 votes
1 answer
451 views

How can I generate multiple hashes in Mac terminal for multiple files?

Suppose I have multiple files in my folder: HuZhou_1_d1_Clean_Data_unaligned.fq.2.gz HuZhou_1_d1_Clean_Data_unaligned.fq.1.gz HuZhou_1_d1_Clean_Data_unaligned.fq.3.gz ...
user avatar
  • 133
2 votes
2 answers
223 views

How can I address an “Cmake is not installed” error running docker on macOS?

I tried to run this https://github.com/mkhaled87/pFaces-OmegaThreads in my Mac terminal and When I entered sh build.sh, it showed CMAKE is not installed. Please install it first. I have CMAKE on my ...
user avatar
  • 21
0 votes
0 answers
70 views

Siri fails to execute a shortcut, throws an error

I'm having troubles executing Shortcuts with Siri. It seems like Siri/Shortcuts doesn't have full disk access or something similar. I create a shortcut with a name "Showcase" see image below....
user avatar
  • 439
2 votes
1 answer
55 views

Turn off wallpaper-tinting from the command line

Anyone know of a command to disable wallpaper tinting? That is, instead of clicking the checkbox in System Preferences.
user avatar
1 vote
0 answers
54 views

Where should .sh and pdftk be copied to in foo.app?

An attempt to run a third party script on Catalina is described: How to interpret / diagnose pdftk error message Test results after executing xattr -rd com.apple.quarantine /Users/user/Desktop/bates-...
user avatar
  • 2,423
1 vote
1 answer
589 views

Detect silent audio via FFMPEG (entire file)

I am trying to pass audio and video files into FFMPEG and determine if their audio is entirely silent (I don't need to detect if the audio stream is present or not, just if it is silent), and ideally ...
user avatar
  • 63
0 votes
0 answers
21 views

Can't view contents of Documents or subfolders/file with CLI only [duplicate]

I do a moderate amount with the command line but have inadvertently done something that confuses me. I needed to download the contents of a webpage with wget so I did this: wget -P -r ~/Documents/...
user avatar
  • 203
-1 votes
1 answer
385 views

How can I delete the files in /System/Volumes/VM?

Just as an experiment/exercise, I tried deleting the swap files in /System/Volumes/VM but no matter what I did, it was prevented. sudo rm - operation not permitted sudo xattr - didn't return anything ...
user avatar
  • 347
1 vote
1 answer
66 views

What is PID 1025 on my Macbook Pro

I am on my Macbook pro and I restarted the machine about an hour ago. There is a process ID (PID 1025) that has been running for about 30 minutes and I do not know what it is. I wanted to understand ...
user avatar
  • 13
8 votes
1 answer
1k views

MacOS Monterey Terminal CLI: "open" command does not change focus

Has anyone encountered an issue in which Terminal.app is no longer able to switch focus to another application? For example, typing in the command open . would have previously opened the current ...
user avatar
  • 351

1 2 3
4
5
56