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.

200 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
8
votes
0answers
822 views

AirPods battery level with `ioreg`

I can query the battery level of my bluetooth devices with ioreg with ioreg -r -l -n devicename | grep '"BatteryPercent"\ =' with the following devices Keyboards: IOAppleBluetoothHIDDriver, ...
5
votes
1answer
116 views

How to increase / decrease a priority of a macOS process?

I'm looking for a way to throttle up a macOS application or a process, specifically photoanalysisd. Ideally a Terminal command that would enable it to use all resources to the point, where any other ...
4
votes
0answers
448 views

Pip Installed Tools: “command not found” | Homebrew Installed Python Tools Work Fine

I installed Python 3 with Homebrew and a tool I was installing through Homebrew auto-installed Python 2.x. So, I have both and pip (etc) is installed for both, unlike the macOS default Python. ...
4
votes
0answers
477 views

Why is `lsof` so slow on macOS 10.13 (High Sierra)?

This is related to this question, but I am on OSX 10.13.4. lsof takes about a minute to run, even with the -n option on. I can't even run dtruss to examine the system calls being made: $ sudo dtruss ...
4
votes
0answers
797 views

Why doesn't ps aux show *everything*?

I recently had a problem with sluggish computer and I live in the terminal, so for me, when something's running slow, "top -o cpu" and "ps aux" are my bread and butter. However, I recently came to ...
4
votes
0answers
301 views

How can I revoke an applications access to keychain passwords from the command-line?

Applications can be granted permanent unprompted access to passwords. You can add and revoke these privileges using the Keychain Access utility. (See this answer) I'd like to be able to revoke from ...
4
votes
1answer
1k views

Is there command to grant Full Disk Access for specific application?

You can allow an application to access data if you change settings in Security & Privacy → Privacy → Full Disk Access. Is there command to accomplish the same in terminal?
4
votes
1answer
296 views

How to change icon of an app through Terminal

I want to customize my app icons, but there's a lot of them, and I don't want to be tedious and go through the whole Get Info process over and over again. Is there any way to write a program, ...
4
votes
1answer
994 views

com.apple.quarantine extended attribute gets re-added each time I open the file

I have a file called tasks.taskpaper that I associated with FoldingText. When I open the file, the dialog pops up with text “tasks.taskpaper” may be a script application. It was created by ...
3
votes
0answers
43 views

Disable USB Storage Devices in El Capitan

The company I work for is required to disable the ability to connect USB mass storage devices on all production computers. All computers run OS X 10.11.6. Every computer has the following setup: USB ...
3
votes
0answers
60 views

How can I detect which button was clicked in the DMG EULA confirmation screen

I'm using the open command to automate (via bash) opening a dmg which has a EULA attached to it. When I run open my_app_distribution.dmg I get a screen that looks like this: The open commands uses ...
3
votes
0answers
72 views

How to screen capture a second desktop in Mac Mojave?

If I call screencapture -R460,250,350,500 ~/Desktop/screenshot.png from the command line, is there an option or way to tell it to take a screenshot of Desktop 2, rather than Desktop 1?
3
votes
0answers
54 views

Automatically send kill -STOP or similar to runaway processes when the lid is closed?

From time to time (maybe a couple of times a week) when I get to my computer (a Macbook Pro) expecting it to be asleep with the lid closed the fans are running Most of the time it is a Chrome process ...
3
votes
0answers
642 views

When installing command line tools using Terminal, I am getting “Software currently unavailable from Software Update server” error

I have downloaded Xcode on my Mac running macOS Mojave and trying to install the command line tools using the following command: xcode-select --install But it is giving me the following error: Why ...
3
votes
0answers
326 views

Renew free provisioning profile from CLI

I'm developing an iOS app to run only on my phone (a.k.a. sideloading), and I don't need to distribute it. With a free iOS dev account, my provisioning profile expires every 7 days. I'm looking for ...
3
votes
0answers
196 views

Rearrange Spaces via command line from the terminal emulator

TL;DR: I need to replace the dashboard with a terminal emulator. Hi. I need to 'rearrange spaces' so a terminal emulator gets first from the left before the desktop, where the dashboard used to be. ...
3
votes
0answers
354 views

Does opensnoop really lists all files that are read?

I have two users on my system, 501 and 505. 501 can sudo, 505 can not. I was logged in in the GUI as 505 and wanted to see what files that were read when I launched a certain program so to run ...
3
votes
0answers
92 views

How do I create Windows-like shortcuts (with arguments) from the command line?

I've been searching and searching for a process on OS X that creates something as simple and elegant as Windows shortcuts. At the user's direction on install, I need to create a shortcut-like item ...
3
votes
0answers
2k views

How can I mount Google Drive File Stream before launchd user agents start?

I have a simple backup bash script that dumps the output of pg_dump for a PostgreSQL database into a Google Drive File Stream directory. This bash script is referenced by a launchd user agent. The ...
3
votes
0answers
414 views

how to install Open Source Samba tool 'smbget' on macOS High Sierra?

It seems smbget is not available on Homebrew. Also the Samba suite not available. This tool is part of the samba(7) suite. smbget is a simple utility with wget-like semantics, that can ...
3
votes
0answers
85 views

Is there a way to disable the Spotlight hot keys via the terminal?

I am trying to make configuration of a new macOS system as automated as possible. I use Alfred and prefer to use Cmd-Space to trigger the Alfred window instead of the install default of calling off to ...
3
votes
0answers
548 views

Opening new Firefox window from command line while it's already running

Does anyone know how to open a new Firefox window from the command line while Firefox is already running? I can't find any solutions currently out there that work for me. I've looked at the MDN web ...
3
votes
0answers
2k views

dyld: Library not loaded, even though path is specified in Makefile

I have a Fortran program which I run on my macOS 10.12.6. The code is compiled using a Makefile, in which all the libraries included have their path included as well. For one of the libraries (and ...
3
votes
0answers
599 views

Command line reading of screen lock timeout preferences

I'm writing a script to check for security compliance on a number of computers and wanted to verify that the user has set the computer to require a password immediately after sleep or screensaver. ...
3
votes
0answers
927 views

How to install and maintain multiple clang versions?

On my MacBook Pro I have Homebrew as well as the CUDA toolkit. OSX and Homebrew prefer the 'latest' version of clang (currently version 9.0.0). Clang is used for several Homebrew packages that I need. ...
3
votes
0answers
759 views

Wireless Networking in Single-User Mode

How to enable AirPort network (and other) services; in single-user mode? Input: (including prompt string) bash-3.2# networksetup -setairportnetwork en0 <network> [password] Output: Error ...
3
votes
0answers
2k views

Airport command line utility only shows man page in macOS 10.12.2

In previous iterations of OSX, I've been able to use the command line utility without issue. Now, no matter what the parameter I send, it shows me the --help output: [andrew@mba] /System/Library/...
3
votes
0answers
436 views

Is there a “findmnt” equivalent for OS X?

I find findmnt's output much easier for a quick scan of the filesystem status than the traditional mount command. Is there an equivalent for it on Mac? It's part of util-linux package. HomeBrew doesn'...
3
votes
0answers
958 views

How can I install bind-utils on El Capitan

I would like to use DNSSEC tools (like dnssec-keygen, dnssec-signzone, ...) on my Mac without running or installing the BIND9 service. Unfortunately for me Homebrew seems only to have the BIND9 ...
3
votes
0answers
1k views

Get rid of the “Instruments wants permission to analyze” prompt, from command line, in Yosemite

In our jenkins build automation environment we have several OSX nodes, now all updated to Yosemite, where we run ios simulator tests. The problem is that on any newly introduced node simulator tests ...
3
votes
0answers
285 views

Missing hard disk space

I'm trying to figure out where my missing hard disk space is going. I'm using du and df from the command line and there seems to be a clear discrepancy. So here's the du output: $ sudo du -h -d 1 / ...
3
votes
1answer
811 views

Turn on Location Services for an app via command line (macOS)

I am trying to enable Location Services for an individual app such as Weather.app etc via command line for High Sierra and Mojave macOS computers. I was able to enable Location Services at the top ...
3
votes
1answer
192 views

Lock keyboard from CLI

I used to use kextload and kextunload to unlock/lock my keyboard. However, the actual kernel extension changes between MacBook models, and that can have unexpected results. For example, if the kext ...
2
votes
0answers
22 views

usr/local/: Can't set user=0/group=0 for usr/localFailed to set file flags

I have been trying to install gofortran with the command: tar -xvf /Users/usr/Downloads/gcc-7.3-bin.tar.gz -C / I immediately get the error: x usr/local/: Can't set user=0/group=0 for usr/localFailed ...
2
votes
0answers
37 views

Please help me repair my update catalog

I have a MacBook Pro 15" mid 2014 model. I was attempting to fix catalog issues because I could not install Catalina. Now, all I am offered is Catalina Beta. I used the command /usr/sbin/...
2
votes
0answers
39 views

Run a local http(s) proxy from command line using built-in commands

We've been using Charles Proxy during the development of a product, but now need to be able to script/automate the same behaviour using command line tools on macOS. My understanding is that Charles ...
2
votes
0answers
46 views

Trigger application “first open” via CLI?

Briefly: I would like to open an application for the first time from the command line, and have it act like it was opened in the Finder for the first time. In more detail: If you download an ...
2
votes
0answers
54 views

Time Machine Restore Woes (how can I edit my backup)

I have a 2019 MacBook Pro I had to send in for service, as usual it was wiped when I got it back, not an issue as J always have an external drive plugged in for backing up. This time though my backup ...
2
votes
0answers
88 views

updated os to mojave 10.14.5, now lsof is giving me errors with stat

I had a system update last Thursday and ever since I have been getting the errors below. I have tried reinstalling lsof via homebrew, upgrading bash, rebooting, but no luck. How do I even go about ...
2
votes
0answers
340 views

Turn on Internet Sharing from Terminal (on Mojave)

In System Preferences > Sharing, there is a way to turn on Internet Sharing so that devices connected to my laptop can use its Internet connection. Start/stop internet sharing from a script? ...
2
votes
0answers
37 views

Terminal commands are not being saved

I am on Mojave 10.14.4 and my terminal literally has 100 or so commands in its history when it should have ten times that. It seems as though it never saves the commands, whether I open the terminal ...
2
votes
0answers
27 views

Problem setting modified date for iCloud directories

I wrote a shell script to change the modification date (using touch) of a set of directories to be the same as the date of the most recently modified file in the directory. (To make it easier to sort ...
2
votes
0answers
626 views

How do I create a minimal chroot jail in macOS?

I am trying to figure out the minimal things I need to do to create a chroot jail in macOS. I have seen a few scripts online (https://github.com/skissane/mkjail, https://github.com/jsarenik/Mac-Hroot),...
2
votes
0answers
521 views

How to compile/install mplayer on MacOS with subtitle support?

In order to play video files with a sub title file on MacOS 10.13.6 on the command line: How to install mplayer so that I am able to use subtitles? I tried the following suggestion made in some ...
2
votes
0answers
213 views

How to prevent “Do you want the application foo to block incoming connections?” popup from command line

As a developer, I run a testsuite of some self-compiled binaries which try to listen on some ports on startup. This causes a barrage of popups "Do you want the application foo to block incoming ...
2
votes
0answers
40 views

Determine if the original path of an alias is local or remote

I have a folder full of thousands of aliases and need to isolate the ones referencing a remote path on another computer on an AFP network. I can iterate all of the alias files over a terminal command ...
2
votes
0answers
85 views

Is it possible to use Python while in Recovery Mode?

Is it possible to access a Python terminal while in Recovery Mode? $ /Volumes/macOS/usr/bin/python python: posix_spawn: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python....
2
votes
0answers
138 views

How to enable/disable Do Not Disturb from shell on Mojave?

I've searched far and wide, but obviously not enough, to find a solution for this on macOS Mojave. I found the answers here, but they don't work on Mojave: https://apple.stackexchange.com/a/303400/...
2
votes
0answers
147 views

mdls returns `(null)`

function ls-by-added() { # Doesn't work well for files having '(null)' as their DateAdded, which some do. mdls -name kMDItemFSName -name kMDItemDateAdded -raw -- *(D) | \ xargs -0 -I {}...
2
votes
0answers
781 views

Mounting a single partition dd image in macOS?

Using testdisk, I have made what is apparently a dd image of a single HFS+ partition (what was originially /dev/disk1s2, I think). Now I try to mount this image file, but seemingly I cannot - even if ...