Stack Exchange Network

Stack Exchange network consists of 175 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

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.

0
votes
0answers
11 views

Vertical/Horizontal offset of external display via command line

I have an old external monitor, and the vertical/horizontal offset is wrong. Fullscreen cuts off the edges of windows. It's HDMI, so it can't be adjusted through the monitor. I remember a few ...
0
votes
1answer
23 views

Connect and run commands over SSH using script

I'm using a series of commands for deploying my files to production. This is currently done manually. Is it possible to make these commands into an executable file? So that I don't have to copy paste ...
0
votes
0answers
11 views

Save Terminal app's multiple tabs' output with a single click?

If one has many many Terminal windows or tabs, is there a way save all of the app's tab's output with a single click or command instead of choosing the Shell > Export Text As option countless times to ...
0
votes
1answer
20 views

How to Install Clang specifically

While trying to run a MATLAB script, I am getting the following error: Compiling minFunc files... Building with 'Xcode with Clang'. Error using mex xcrun: error: invalid active developer path (/...
2
votes
3answers
39 views

Move file with specific extension from a directory hierarchy to a destination

I have a directory hierarchy containing many images with .jpg file-extension, and there are multiple folders containing these images. There are many .json files as well in these folders. Is there a ...
0
votes
1answer
21 views

result returns just new line \n not whats printed after command is run

Ultimately I'm trying to catch some errors that are popping up but aren't getting returned. Here's the command I'm trying to run. /usr/bin/dscl . -change /Users/admin NFSHomeDirectory /Users/admin ...
0
votes
2answers
73 views

Change file creation date to modification date using terminal

So I have a bunch of pictures that have incorrect creation dates but their real creation dates are the same as the current modification dates. Is it possible to correct this using some batch command ...
1
vote
0answers
32 views

How to isolate systemic hangs in macOS 10.14?

I'm struggling with some kind of a hang that is very elusive. Apple can't seem to isolate the problem after many sysdiagnose submissions. It predominantly happens in instances of Google Chrome, Finder ...
1
vote
1answer
28 views

FileVault2 command line commands in Mojave?

I've been reading about using the fdsetup command to manage FileVault2 from the command line. But I can't find it in Mojave (or High Sierra for that matter). Is there a command line interface to ...
3
votes
1answer
29 views

How do I use `log stream` to search ALL existent logs on macOS for strings?

I need to search all logs on macOS Mojave for "some string". I was told that the way to do this was to execute: sudo log stream --source --start'1999-99-99 23:59' | egrep -i "some regex string" ...
0
votes
1answer
41 views

Set the Working Folder of `.app` Created by Apple Script

I have a simple Shell File .sh which copies files form the PWD to a destination folder. This is basically Hand Made installer of a program. I want to create an APP from it. The idea is to have the ...
3
votes
0answers
28 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?
0
votes
2answers
35 views

What’s the difference between diskutil unmount and diskutil eject?

On macOS (eg. Mojave 10.14), what is the difference between the diskutil unmount and diskutil eject commands? For example, if I want to execute this from the command line (eg. bash in terminal), but ...
4
votes
1answer
50 views

How can I center a PNG with a transparent background using the CLI?

I'd like to come up with a technique for properly posting images on this site on my Macbook using a CLI tool to do the conversion. This is a sample image that I'd like to make it so that the image is ...
1
vote
0answers
12 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 ...
1
vote
1answer
45 views

bash $PS1 containing an emoj

This question is related to https://apple.stackexchange.com/a/357132/44531 I would like to have a space after the emoj 😱. I've tried in the script below but I'm getting two lines instead of the ...
0
votes
1answer
36 views

How can I make macOS respect HOSTALIASES environment variable?

According to the Apple developer documentation, setting HOSTALIASES will make a process look in that file for hostnames instead of /etc/hosts. However when I tested this with ping and a replacement ...
0
votes
0answers
52 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),...
0
votes
0answers
25 views

On Mac terminal keyboard key action macros?

I want to assign long commands in one key on Mac terminal. For example, I have assigned command php bin/magento under F13 key from "Terminal → Preference → Profiles → Basic → ...
0
votes
0answers
24 views

Add IP alias on macOS like on Ubuntu? [duplicate]

I want to add a second IP address on my Mac like on Ubuntu. On Ubuntu I use this: $ sudo ip addr add 192.168.1.12/24 dev eth0 On my Mac I used this: $ sudo ifconfig en0 alias 192.168.1.12/24 On ...
3
votes
1answer
37 views

Is it possible to fix the spacing when using “ls” with colored output?

This is the exact same issue found here: https://unix.stackexchange.com/questions/165154/changing-the-spacing-between-files-in-ls When you run the command ls -G or CLICOLOR=1; ls the spacing in the ...
1
vote
1answer
15 views

extract if_index without grep from scutil --dns

I'm using the grep command to extract active interfaces from the output of the scutil command with the --dns option. $ scutil --dns | grep 'if_index' I am suspecting if a user's machine with ...
1
vote
1answer
26 views

Does a wget showing full request headers, exist on mac? The GNU wget on mac doesn't but the GNU wget on windows (Wget 1.19)

Does a wget showing full request headers, exist on mac? The GNU wget on mac doesn't but the GNU wget on windows (Wget 1.19) The example output that I want, is what I get on GNU Wget in Windows (This ...
1
vote
1answer
31 views

How do I decode the contents of Apple System Logs in /var/log/DiagnosticMessages (using the command line)

I would like to decode the contents of the files in /var/log/DiagnosticMessages. My laptop currently has 52MB of such files: $ ls -l total 53572 -rw-r--r--@ 1 root admin 483660 Mar 11 22:48 2019....
1
vote
0answers
24 views

“open” command not working after upgrade to High Sierra

After my recent upgrade to High Sierra, the command line command "open" no longer opens much. I have tried it on PDF, PPTX, png. It does work on ascii text files. The 'Preview' app does open if I ...
2
votes
0answers
99 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. ...
3
votes
4answers
750 views

“which” command doesn't work / path of Safari?

Why can’t I locate programs like Chrome or Safari or FireFox with the which command line tool? pasocon:~ ThisUser$ which python /anaconda3/bin/python pasocon:~ ThisUser$ which firefox pasocon:~ ...
2
votes
1answer
40 views

How can I make sure that the title of a Terminal tab/window is identical to the command I typed

I noticed that for aliases etc the title of a Terminal tab/window often isn't the same as the command I typed. This is sometimes confusing, especially for long-running processes with similar names. ...
0
votes
1answer
65 views

Why does chunkwm fail with “Permission denied” error for .chunkwmrc

ashleyharvey@Themis:~$ ls -al .chunkwmrc -rw------- 2 ashleyharvey staff 4.7K Apr 4 22:24 .chunkwmrc ashleyharvey@Themis:~$ chunkwm /bin/bash: /Users/ashleyharvey/.chunkwmrc: Permission denied So, ...
1
vote
1answer
25 views

LSCOLORS format

I want to configure my .bash_profile and I've seen this post about BSD based ls configuration: https://www.cyberciti.biz/faq/apple-mac-osx-terminal-color-ls-output-option/ I just don't know what is ...
26
votes
1answer
3k views

I Accidentally Deleted a Stock Terminal Theme

I accidentally deleted a stock Apple terminal theme that I'd like to get back. The one I accidentally deleted is called "Pro" (under the Profiles tab in the Terminal settings). Is there a way to get ...
0
votes
0answers
27 views

How do sort files by name in ls without putting capitals first? [duplicate]

How do I really sort files by name in ls without putting capitals first? $ ls -l total 0 -rw-r--r-- 1 apple staff 0 3 Apr 13:38 C -rw-r--r-- 1 apple staff 0 3 Apr 13:38 a -rw-r--r-- 1 apple ...
3
votes
1answer
834 views

Software update wants to install Command Line Tools. Why? I have no Xcode installed

Next to the mac OS 10.14.4-Update, Softwareupdate also shows me the following as a further update / download: Command Line Tools (macOS Mojave version 10.14) for Xcode 10.2 Now if I need it, I am ...
1
vote
3answers
75 views

grep command is killed

I am running grep -o $string ~/giant_file where string="foo bar baz" This process keeps being killed after running for awhile and generating results, and I don't understand why. When it is killed, ...
4
votes
0answers
29 views

Is there a script/cmd that I can create/run that will allow me to install .dmg? [duplicate]

I have been working on a "Mac Rollout Project". After I run the Macs through the Apple setup, I have a list of .DMG / Applications that I have to install. There is no particular order that the .DMG / ...
7
votes
2answers
541 views

How does the mv command work with external drives?

On the same drive I assume it would change something like a FAT table to repoint to the location of files. Question When going to a different drive (maybe even partition) does the mv command first ...
1
vote
1answer
81 views

How to fix Permission Denied error when starting up MongoDB

So I'm newbie to learning react and node and thought of building something based on MERN stack - I installed mongodb using npm install -g mongodb then it says its installed - then to create data ...
1
vote
1answer
16 views

How to provide detailed listing of /tmp directory

The standard options to ls are not working: I get the following 14:53:37/a2a $ls -l /tmp lrwxr-xr-x@ 1 root wheel 11 Jan 9 14:16 /tmp -> private/tmp $ls -lrta /tmp lrwxr-xr-x@ 1 root wheel ...
6
votes
3answers
1k views

Compilation error with Mojave: error: ‘_Atomic’ does not name a type

After updating to Mojave 10.14.4 and Xcode 10.2, I fail to compile GCC 8.3.0. The error message is In file included from /usr/include/sys/sysctl.h:83, from ../../gcc-8.3.0/gcc/config/...
0
votes
2answers
43 views

Best way to run Shell commands on VirtualBox Guest

What's the best way to run shell commands on a MacOS guest VM? Can't seem to run it through VirtualBox's guestcontrol, only lets you launch apps, not run commands directly. Saw some people suggest SSH,...
21
votes
5answers
3k views

How can I quit an app using Terminal?

I want to quit a certain applications on my Mac using Terminal. For example, how do I kill “Slack”? Do I need its PID number?
0
votes
1answer
78 views

How to make `sudo su` run startup scripts?

Supposedly the bin/sh shell that is the default root shell is not strictly a "bash" shell, but is a POSIX compliant equivalent. According to this site, when you invoke the shell executable of a "...
1
vote
0answers
23 views

How to find the list of icons that can be used in mac cli applications

I'm currently developing a node cli application and having used npm tools, my interest has been piqued by the use of npm-check and its use of icons in its cli interface. eg: There must be plenty of ...
0
votes
1answer
124 views

How do I observe and control a macOS update using `softwareupdate`?

I made the mistake (don't ask) of entering softwareupdate -ia --verbose in Terminal, which is now stuck doing — I don't know what: Software Update Tool Finding available software Downloading ...
-1
votes
1answer
31 views

“arp -a” output differs on computers attached to the same network

When I type arp -a I get all devices on the local network, right? My question is this: how come when I type this command on two separate machines, I get two different results? And when I ping the ...
3
votes
1answer
59 views

Extract numbers from string using shell

Using shell script, how do I extract two sets of numbers from a string like "R14C11"? I'd like to get the result as an AppleScript list. R14C11 -> {14, 11} R5C9 -> {5, 9} "R" and "C" will be ...
9
votes
3answers
1k views

Is xar preinstalled on macOS? [duplicate]

$ which xar /usr/bin/xar It's in /usr/bin. Does that mean it's preinstalled on mac?
0
votes
0answers
49 views

Find commande doesn't list existing file

Ok so! I search the file latexindent. The command typpe latexindent given me latexindent is /Library/TeX/texbin/latexindent. I execute find /Library/TeX/texbin/ -name "*latexindent*" but I don't have ...
0
votes
1answer
26 views

How to prevent browser from redirecting AT ALL using terminal

I have a very limited knowledge of this stuff so I hope this explanation makes sense.... My parents have somehow got on my MacBook, and made it so that they can change any setting and view/modify my ...
0
votes
0answers
14 views

Get Keychain password when managed by Network Access Server

I have a corporate macOS computer where the password is managed by a Network Access Server for Active Directory. If an admin changes my password on their system and my computer is connected to the ...