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
3
votes
1answer
39 views

Entering path containing spaces in Terminal

Working on my MacBook Pro, I want to change the location of my iPhone backup to an external drive, but when entering the command on the CLI I hadn't noticed that the destination drive has a space in ...
3
votes
3answers
348 views

Remove sudoers using script

At the moment I'm working on a solution to prevent all admins users (except one particular) from running sudo. I can add a specific user to sudoers by running: sudo -i echo '$username ALL=(ALL:ALL) ...
1
vote
0answers
67 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 ...
4
votes
3answers
360 views

Can't connect to Internet in bash using Mac OS

My browser works perfectly using the using Internet, however, when I tried to use this command in bash: ping -q -w1 -c1 google.com &>/dev/null && echo online || echo offline It gives ...
1
vote
1answer
53 views

Why does sed -i create random files with “q” commands?

I’m aware that BSD sed behaves differently from GNU sed with regards to the -i option. However, the usual way of using sed -i '' on macOS ceases to work when using a q command, and I’m wondering ...
0
votes
0answers
20 views

Forward deleting (Macports/bash): Is there an alternative to Fn+Delete and Control+D?

As a more general version to this question, is there a way to forward-delete in a bash terminal that doesn't involve Fn+Delete or Control+D? Motivation: When using the Macports port command ...
1
vote
1answer
27 views

transfer video file to iphone from macbook over shared internet connection

My iPhone is USB-connected to my macbook and my macbook has internet sharing turned on. How can i send a video file from my macbook to the iphone using the command line?
2
votes
0answers
158 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? ...
0
votes
1answer
29 views

How to forward delete in Macports?

When using the interactive Macports shell (running port), is there a way to delete characters to the right of the cursor? Normally, you can simply use key the combination Fn + Delete to forward-...
1
vote
0answers
179 views

macOS Mojave Command line: How to mount drive but NOT EFI and hidden partitions

If I connect a external GUID-Formated Mac Drive, the Finder does mount all partitions except the "hidden" ones EFI and if existing "Recovery HD". That's fine so far. If I unmount the disk in the ...
0
votes
0answers
149 views

Sysadminctl - sudo vs no sudo/interactive vs non-interactive

I have a Mac with Mojave installed on an APFS partition. I run sysadminctl to change the Secure Token status for some users. Based on the information I found on the web it wasn't clear to me how I ...
0
votes
1answer
62 views

How can I download files from Linux to macOS only using the existing SSH connection?

How can I download files from Linux to my Mac OS using only the existing ssh connection? I know if I use the Windows System, I can use lrzsz to down files: yum install lrzsz sz file // there can ...
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 ...
0
votes
2answers
279 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
29 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 ...
1
vote
1answer
98 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
48 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
34 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
240 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
46 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
177 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
76 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
55 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
39 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
58 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 ...
3
votes
1answer
58 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
21 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
70 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
71 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 ...
1
vote
0answers
399 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

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 ...
4
votes
1answer
57 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
23 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
70 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
98 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
28 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 ...
4
votes
0answers
375 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. ...
2
votes
4answers
812 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
109 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
109 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
35 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 ...
27
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 ...
4
votes
1answer
2k views

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

After the MacOS 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 fine ...
1
vote
3answers
96 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
30 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
608 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
308 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
20 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
2k 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/...