Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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.

2
votes
2answers
24 views

Can't open a PDF from Terminal on Mac because it ‘couldn't get a file descriptor referring to the console’

I tried to use the command: open <filename.pdf> but the message I got was Couldn't get a file descriptor referring to the console What can I do?
1
vote
1answer
35 views

macOS: Trigger a script when a second monitor is attached

I am on macOS El Captain (upgrading to High Sierra soon) and I'm looking for a tool which can trigger an AppleScript or shell script when the number of monitors/displays attached to the system changes....
3
votes
3answers
85 views

How can I find the “friendly name” of the operating system from the shell / Terminal / bash?

I know that I can use sw_ver to find this information: ProductName: Mac OS X ProductVersion: 10.14 BuildVersion: 18A353d …and I know I can find other things like uname can give me some types of ...
0
votes
0answers
14 views

Installing gcc twice on a Snow Leopard machine?

I have an old early 2008 Macbook that runs Snow Leopard and can't upgrade to anything better. I wanted to install a C++ compiler on it and finally stumbled across this: https://github.com/...
0
votes
1answer
15 views

bsdtar gives (Empty error message) when trying to extract an ISO

On High Sierra 10.13.6 (17G65), trying to bsdtar -xf something.iso fails with: bsdtar: (Empty error message) bsdtar: Error exit delayed from previous errors. I have plenty of disk space left and ...
4
votes
2answers
99 views

How to implement text editing features in terminal interface?

Sorry if the title is confusing but essentially what I want is to have standard text editor features like Command< to move to the beginning of the line or CommandShiftBackspace to erase a line. Is ...
1
vote
0answers
18 views

AirPort - How to put accessories on a network using command line instead of AirPort App

I have an application where my application device starts a WAC(Wi-Fi Accessory Configuration). I then use either my Mac or iPhone to put that application device on a network. In Mac, I see my ...
1
vote
0answers
27 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
1answer
25 views

How to check if file is in use?

I have c++ application and I need to know if one file is in use by anyone. I'm ok with running any shell command, but I don't want to run lsof command for this purpose, since I think I can't safely ...
3
votes
1answer
32 views

How to auto paste above return value on command line

I am trying to create a very simple script (.command) that will basically change my mac address.. i do know that the command: openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//' will return me a ...
0
votes
0answers
30 views

How to disable CoreAnalytics (system diagnostics mechanism) used by forensics investigators

From I Know What You Did Last Month: A New Artifact of Execution on macOS 10.13 Analysts that perform macOS forensics have had few, if any, artifacts of program execution to rely on during ...
0
votes
1answer
22 views

Finding minimized apps through terminal

I would like to know how to find what apps are minimized in the dock but through the terminal? The idea is to make a script that pauses minimized apps in order to reduce memory usage but the first ...
0
votes
0answers
12 views

Make iTerm2 read profile from file, from the CLI?

I want to make iTerm have these values set: - Load preferences from a custom folder or URL - Save changes to folder when iTerm quits And I want to set them from a CLI command (no GUI, no clicks). ...
0
votes
1answer
25 views

Atom editor no longer opens from command line

I've been using the Atom editor on my iMac running High Sierra. I usually run it from the terminal by typing atom. I moved many of my apps to an external drive to free up disk space. I originally ...
1
vote
1answer
34 views

What is the equivalent of the 'gsettings' command on OS X?

Under Ubuntu it's possible to get various settings information via gsettings command in terminal. For instance, current wallpaper path can be obtained via $ gsettings get org.gnome.desktop.background ...
1
vote
1answer
191 views

Cannot run refind-install from Recovery because “/usr/bin/env: bad interpreter”

I have managed to change the present working directory to the folder containing downloaded rEFInd files. I have booted to Recovery Mode. The refind-bin-0.11.3 folder was downloaded to my Downloads ...
1
vote
0answers
16 views

Anaconda-Navigator no longer works by double clicking on icon

I use an iMac running High Sierra 10.13.5. I'm use the Anaconda distribution of Python 2.7 and 3.6. I normally opened Anaconda-Navigator by double-clicking on the application in my Applications Folder....
2
votes
1answer
42 views

Unable to launch app using “open” command in Terminal

I have recently started using Terminal.app a lot. I figured that open command will be helpful in opening files like HTML, CSS files etc. I have tried Visual Studio Code app from Microsoft. The app ...
1
vote
0answers
27 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 ...
1
vote
1answer
37 views

NTLM hash function in Terminal?

I'm aware there are a number of hash functions available in terminal such as echo "text" | openssl <hashname> or perl -MDigest::SHA -nle 'print Digest::SHA::sha224_hex($_), ":", $_'. However, I ...
1
vote
0answers
21 views

Preferences changes using “defaults” not applied

I'm a CLI enthusiast and, as such, I've been a extensive user of brew, cask, m, mas, softwareupdate and so on. I've even written some tutorials about them (check here and there). Right now, I'm ...
1
vote
0answers
192 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 ...
0
votes
0answers
15 views

Import SSL Cert into Chrome via Command Line?

In MacOS (High Sierra), is it possible to import a custom Certificate Authority (.crt) using Terminal or over SSH?
0
votes
0answers
30 views

Is there a way to speed up download from wget in terminal

I am trying to download about 80,000 files (each is about 2-3 MB) from a website using wget. It has been a day and I have downloaded just about 9,000 files. I checked their download speed and they ...
2
votes
1answer
30 views

Terminal process stopped when MacBook Pro was closed and opened

I am installing files from a website using wget in Terminal and when I closed and reopened my Mac, the download stopped. Is there a way to start it again?
0
votes
0answers
45 views

How can I get an image selection programmatically?

I need to log the bounding box of the selected area from an image to the command line. This is because I will have to do this across a number of images and then compare and reuse those bounding boxes....
2
votes
1answer
21 views

How to create link aggregates (bonded interfaces) in shell?

How do you create link aggregates for network interfaces from the shell in Terminal on macOS 10.13?
0
votes
0answers
25 views

`launchctl export` command not working?

According to the man page of launchctl, there is an export command: export Export all of the environment variables of launchd for use in a shell eval statement. However, when I try to use ...
0
votes
2answers
32 views

How to list all /dev/disks, not partitions ending in s1, s2, …?

I am trying to list (output) the drive its Mac OS X name from the serial number in the Bash 3.2 shell on the command line. For this I need to loop through all block devices not being a partition. So I ...
2
votes
0answers
68 views

The `ntpdate` command was removed from Mojave. What to use now? [duplicate]

In the latest macOS version (Mojave 10.14 Beta) the ntpdate tool has been removed. What I want to do is to simply restart the computer clock using an NTP server: sudo ntpdate -u pool.ntp.org Has ...
0
votes
1answer
44 views

banner - horizontal text

On my Linux box, if I do banner message I get a horizontal banner saying "banner". However, on my Mac I get a vertical banner. How do you revert this to horizontal?
1
vote
1answer
28 views

How do I map a terminal command to a function key?

I have a terminal command that can control my external display's brightness. I'm trying to map that command to a key on the keyboard so it works like a "brightness up" and "brightness down" key. ...
2
votes
1answer
35 views

Can't run go file with go run (filename)

I just started getting into Golang and wanted to run a file in the terminal with go run and then the file name which is main.go I configured the GOPATH like so: export GOROOT="/usr/local/go" ...
13
votes
1answer
988 views

Why aren't the section titles of man pages completely greppable?

This was tested in El Capitan and in a colleague's High Sierra, in the standard Terminal (bash). user@hostname ~ $ man ls | grep "BU" BUGS user@hostname ~ $ man ls | grep "BUG" user@hostname ~ $ ...
2
votes
1answer
46 views

mdfind -onlyin wildcard without pipe

Can -onlyin contain wildcards? mdfind pattern -onlyin '*bin' I know this works: mdfind pattern | grep bin
1
vote
0answers
25 views

Map MIME type to extension application-agnostically via command-line

I am aware that one can view the system's mapping of MIME type to file extension via: defaults read /System/Library/CoreServices/CoreTypes.bundle/Contents/Info.plist MIMETypeToExtensionMap. I am also ...
4
votes
0answers
101 views

Is there a way via the command line to cause .icloud files to download?

Under iCloud in the Settings app, I have "Optimize Mac Storage" checked and "Desktop & Documents Folders" checked under "Apps that store documents and data in iCloud will appear here:" This will ...
2
votes
0answers
58 views

Preferred way to set default application by content/MIME type from the command line [closed]

Per https://apple.stackexchange.com/a/9883/206073 , default file opening by content type should be set via LSHandlers -> LSHandlerContentType in com.apple.LaunchServices/com.apple.launchservices....
0
votes
1answer
26 views

how to read kernel_task cpu in command line

i always thought this showed up in regular top (for me top -u). but now i see it doesn't -- at least not in 10.13 machine that i'm working on. it's important to me record a machine's use/stress at ...
0
votes
2answers
51 views

How to alias/redefine rm command in Mac terminal to do rm -v

I need to see what files are removed. So I want to redefine rm to rm -v. Could you please help?
2
votes
3answers
79 views

Generic exit function for iTerm2

I've recently begun to use iTerm2 instead of the macOS Terminal application and I'm really happy with it. I very used to use to exit command to close the instance that currently has focus. With ...
3
votes
0answers
41 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
2answers
309 views

Removing uninstalled Command Line Tools from AppStore updates

I have deleted the Xcode Command Line Tools from my machine by essentially removing the folder. However, AppStore still shows updates from the CLI tools, which obviously I don't want. I've been ...
1
vote
0answers
20 views

Where are services that belong to a certain application stored? E.g., Make New Sticky Note or New BBEdit Document With Selection

Where are services that belong to a certain application stored? E.g., Make New Sticky Note or New BBEdit Document With Selection. They are not in /System/Library/Services nor in ~/Library/Services or ...
1
vote
0answers
35 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 ...
4
votes
1answer
123 views

installing software on MacBook in /usr/bin

I'm trying to install a set of software tools, the "PureScript compiler", on my Mac. I actually installed an older version with npm, like sudo npm install -g purs I need to get the latest version, ...
1
vote
0answers
5 views

`dtrace_deadman_timeout` modification for dtrace scripts such as dtruss?

When running some intensive debugging that needs to run on the order of about 5 minutes, I'm finding that dtrace's deadman switch is being triggered regularly and cannot get to the error that is being ...
2
votes
1answer
119 views

Command Line (CLI) Command for disconnecting wifi from current network

I'm looking for a way to disconnect from my current WIFI network via CLI. There is a way to do that, but it's a GUI way. Any ideas how to accomplish that? Thanks! Note: I don't want to disable Wi-...
0
votes
0answers
10 views

Trigger Process when a Network Connection was Established

I got a litte command line script which should be started when my Mac has established a new network/internet connection. Is there a way to do that?
2
votes
1answer
78 views

How can I search 360,000 files, about 280 GB?

I have a folder (technically in this case, a read-only mounted disk image) containing a ton of data I got by running Data Rescue (a data recovery app) on one of my large server drives. I did several ...