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.

181 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
8
votes
0answers
689 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, ...
4
votes
0answers
370 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
444 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
749 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
300 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
256 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
969 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
55 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
38 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
45 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
590 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
293 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
162 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
82 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
81 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
515 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
522 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
872 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
731 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
894 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
273 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
800 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?
3
votes
1answer
553 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
174 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
58 views

How to check if any audio is currently playing via Terminal?

Sometimes I turn up the audio on my MacBook, but then forget to turn it back down. Is there a terminal command I could use to detect if audio is currently playing (sound coming from the speakers)? I ...
2
votes
0answers
149 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
394 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
191 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
38 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
1k views

Apple Remove Dock Icon with a command line

I'm trying to find the terminal command which can remove an icon from the dock, but I can't find the solution. I tried the defaults read / defaults write command but it doesn't seem to have the ...
2
votes
0answers
96 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
124 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
658 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 ...
2
votes
0answers
1k views

brew install package asks to install command line tools from a path that doesn't exist

I messed up my command line tools. I already had them installed (and were working pretty great), I also installed the beta 2 macOS 10 version from the apple developers site because the command brew ...
2
votes
0answers
315 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 ...
2
votes
0answers
1k views

How to change current JRE on mac?

I would like to change the current JRE from Version 10.0.1 to some previous versions like 1.8 for instance. At the moment Im confused about my current setting. Basically, Java Panel in System ...
2
votes
0answers
28 views

Display all the processes with top

I tried to view all the processes dynamically with command top, unfortunately, it not allows forward movements of command less, just show one page. Meanwhile, top command works properly on ubuntu. ...
2
votes
0answers
69 views

path difference on script vs in shell

Why is the output of $PATH different when in a script vs when running $PATH from the terminal? Even for a minimal script like this: #!/bin/bash echo $PATH it will not match what I get when typing in ...
2
votes
0answers
194 views

Can I modify iTerm window titles for some but not all running commands?

I was looking for a solution to auto set custom title in the terminal based on what command is being run on the current terminal. So, rather than java showing in many tabs - I'd love to have it pick ...
2
votes
0answers
734 views

Captive portal on MacOS

I want to implement a basic captive portal. For the test setup, I have a mac mini connect to wifi (192.168.1.1) and ubuntu laptop connected to it via lan. What I am trying to achieve is for the the ...
2
votes
0answers
378 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 ...
2
votes
0answers
37 views

How to fix the command line shortcut for the Brackets editor?

I've installed Brackets, but if I try to type brackets at the command line I get -bash: brackets.sh: command not found I've found that the shell script is located in /Applications/Brackets.app/...
2
votes
0answers
34 views

opening a new terminal in the /tmp folder exits the new terminal immediately

when I type this command open -a Terminal . while I am on the /tmp folder, a terminal appears and exits immediately. Before the new terminal gets disappeared, I see this message: Last login: Wed Aug ...
2
votes
0answers
921 views

Server-side copy on SMB share via command line

I need to copy a large number of files and folders from one folder to another on the same SMB share exposed by an Isilon server featuring server-side copy. Copying individual files and folders through ...
2
votes
0answers
205 views

Why does fish shell create a hidden process in iTerm2

I've moved from bash to fish shell in iTerm2. However, whenever I start iTerm2, I receive the following error message: A session ended very soon after starting. Check that the command in profile ...