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
1
vote
1answer
36 views

Reset NVRAM, PRAM, and SMC, all in one go from the terminal?

I'd like to run some code, go away and have a coffee and come back to a MacBook with the NVRAM, PRAM and SMC all reset (rather than doing them manually with yoga postures to press all the keys, ...
2
votes
1answer
25 views

How to create recursive download and rename bash script

I need to make a bash script that will download a image with curl and then rename the file, wait 5 mins and then re-download the file and rename it again so that the new file does not replace the old ...
3
votes
1answer
43 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 ...
3
votes
3answers
48 views

How to eject all drives from the command-line

I want to eject all hard drives with a command on the Terminal instead of going to the Finder and pressing eject on each drive. How can I do it?
1
vote
1answer
40 views

Why is wc -c printing spaces before the number?

command: echo "test" | wc -c results (7 leading spaces): " 5" I tested this on my linux box and I don't get the space in front of the five. is this a bug or expected behavior?
0
votes
2answers
42 views

Play Music from iTunes in Terminal

Is there a way to play music from iTunes with a Terminal command? I've tried to do this with the afplay command, but the music won't play because of a locked mp4 music file.
3
votes
0answers
24 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 ...
1
vote
0answers
25 views

How to pass filename as an argument passed on launch?

I would like to pass the script's filename to the "Arguments Passed On Launch" found in the Scheme editor under "Run". I looked at this Xcode documentation but did not find an answer. Currently, I ...
2
votes
1answer
19 views

ImageMagick complains when image is missing while stitching together tiles of an image

I have to stitch together pictures (first vertically, then horizontally) with a varying amount of tiles via the command line on macOS 10.14.5. I usually use this command: convert -append 0_0.jpeg 0_1....
1
vote
1answer
24 views

Merge two pdf to one with their pages merged alternatively [duplicate]

I have a PDF A.pdf and B.pdf and would like to merge them both to AB.pdf, where each page is merged alternately so that page 1 in AB.pdf would be the first page of A.pdf and page 2 in AB.pdf would be ...
1
vote
0answers
30 views

Programmatically confirm whether data on my Mac is synced to iCloud?

I'm writing a script to highlight things I need to resolve before I'm ready to wipe a macOS system. I use them sans-network often, so it'd be nice to confirm I don't have unsynced apps or classes of ...
0
votes
0answers
23 views

Open MPI broken after upgrading to Mac OS X 10.14.6

After upgrading to 10.14.6, openmpi no longer works on my MacBook Air (2019). Attempting to run any related commands mpicxx or mpiexec produce the error dyld: Library not loaded: /usr/local/opt/...
0
votes
0answers
16 views

Can someone help me with curl for table? [closed]

I'm fairly new to the curl command, and since my country been hit with serious haze lately, I've been trying to get updated for the API since I have elderly at home and would like to keep them alert. ...
1
vote
1answer
51 views

Why is my .ssh/config file not readable?

I am trying to edit my ssh/config file, but when I type emacs ~/.ssh/config into Terminal, it says that the file is not readable and will not save my edits. When I try to overwrite, it says permission ...
-1
votes
0answers
19 views

How to open .wrd and .def files on Mac

I found these files here: dictionary bundle (.zip containing .wrd and .def) DictionarySearchStandalone.jar I don't want to run this app because (a) I don't trust the dev, and (b) I don't want to ...
1
vote
2answers
115 views

Mac Terminal: Edit Text Document

I‘m again trying to make a siri-shortcut which let you run applications on your Mac. https://www.icloud.com/shortcuts/f74c9bd89f1a4e71a3e8f72da5cf5ab7 It's making a list of all your applications in ...
0
votes
0answers
29 views

Change user password without the old one on macOS Catalina

How do I change a user's password without the old one, via the command line, on macOS Catalina beta? sudo dscl . -passwd /Users/abc password used to work before Catalina, but asks for the old password ...
0
votes
0answers
12 views

How to identify the selected audio input device from the command-line?

I ran this command to display the i/o registry kit and I was looking for information to indicate the active mic input device. But the 2nd mic shows 'active' (when running the command) but the built ...
0
votes
1answer
37 views

Equivalent of objcopy -0 binary for Mach-O object files in macOS?

Equivalent of objcopy -O binary <FILE> <FILE>.bin for Mach-O object files in macOS? I want to dump the executable code in the __TEXT segment to a flat binary file on macOS. This can be ...
3
votes
3answers
118 views

Mac Terminal: Avoid password

I‘m trying to make a siri-shortcut which let you shutdown your mac. https://www.icloud.com/shortcuts/7c625a68308740d9b84cc0eaa9353055 The command is: sudo shutdown -h now But when I run this ...
1
vote
0answers
9 views

How to display the marked position at the very top when jumping to previous mark in iTerm?

When you jump to a previous mark in iTerm, the marked position will be displayed in (vertically) the middle of the terminal window. But instead of displaying it in the middle, I want it to be ...
1
vote
1answer
30 views

How to mimic CTRL-d in Linux on Mac terminal

If I want to move a folder or file at some relative location, in Linux I use for example: mv ../../<CTRL-d> And that gives me a listing of files/folders at ../../ so I can quickly (using the TAB ...
2
votes
1answer
52 views

Terminal Speedtest Script MacOS

I am looking for a Terminal Script for MacOS to monitor my bandwidth and ping etc. like this (linux) -> https://gitgud.io/J0s3f/speedtest_cron/tree/master I have the speedtest-cli installed via ...
3
votes
4answers
196 views

How can I identify the macOS version from the command line? [duplicate]

After detecting a GNU/Linux system through running uname, in a GNU/Linux distribution lsb_release -a is a good entry level utility you could use to [try to] find out the GNU/Linux distribution name ...
3
votes
1answer
726 views

How do you get the angle of the lid from the CLI?

I know that you get whether the lid is open or closed from: ioreg -r -k AppleClamshellState -d 4 | grep AppleClamshellState. What I want to know is if the lid is open, what is its angle relative to ...
2
votes
3answers
638 views

How to check status of Wi-Fi adapter through command line?

I read a few stacks on the internet but command line was used only to turn Wi-Fi on or off, but none of them to check the on-off status of Wi-Fi. Any possible way to check status of Wi-Fi adapter on ...
1
vote
1answer
26 views

Is there a programmatic way to save and re-create launchpad groups in Mojave?

I have to switch machines from time to time. I keep a dotfiles that's pretty elaborate, as part of this routine. I'd also like to make my launchpad folders be portable. I'm fine with solution that ...
2
votes
0answers
51 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 ...
4
votes
1answer
2k views

What does rm -rf $(!!) mean on macOS?

I know rm -rf is a force deletion on everything in a given directory. But I don’t understand what rm -rf $(!!) will do on the command line. How can I look up this syntax or understand what it will do?...
-1
votes
0answers
34 views

Problems installing metasploit in MacOS terminal

Load error showing up when trying to start metasploit framework on MacOS terminal Fresh install of metasploit on mac by using brew install metasploit Using a Macbookpro 2015 Retina 13inch 2.6 ghz ...
1
vote
1answer
26 views

Can’t use man command on iSH

I have recently downloaded iSH from TestFlight, that I have downloaded from the App Store, and I can’t use the command ‘man’, it returns me an error. -ash: man: not found Is there an alias or can’t ...
1
vote
2answers
121 views

Command in bash shell script to find path to that script?

Is there a command to go inside a bash .sh script that will provide the full path to the directory containing that script?
1
vote
1answer
37 views

Including virtual environment in bash prompt

I am using bash on MacBook Air running macOS Mojave and wanted to change the color of terminal prompt. I was helped on this question on SO and this IBM blog after which I used export PS1="\[\e[...
2
votes
1answer
74 views

MacOS zsh alias pwd is incorrect

I recently switched to MacOS and some aliases in ZSH which were working on a linux system is giving me headaches in MacOS. To be specific, pwd variable inside alias is using the same directory where ...
0
votes
0answers
60 views

.command The file could not be executed because you do not have appropriate access privileges

I am trying to execute a terminal command by just double clicking a .command file. But I am getting this error. The file “myfile.command” could not be executed because you do not have appropriate ...
1
vote
1answer
39 views

Lock macOS with a password from bash

Is there a way to lock macOS so that waking it up requires the user’s password? (Even If normally the password won’t be requested if it is waked up in, say, 1 hour)
2
votes
2answers
259 views

Specific: effect of rm -r /./*

I was trying to delete files inside the current directory with rm -r /./* command. When executed it warned me about removing "...Siri..Application". I kind of panicked, thinking it's trying to delete ...
1
vote
2answers
24 views

Command Line for Final Cut Pro Import?

Is there a command that I can use for importation of files into Final Cut Pro? I tried this next command but Command-O is not the way to import files. open -g -a "/Applications/Final Cut Pro.app" /...
1
vote
0answers
21 views

How do I make a new terminal window that is a child process of another one?

How do I make a new terminal window that is a child process of another one? for example, If I am in one terminal and I do export zzz=123 then a child process should have $zzz . If I do cmd-n ...
0
votes
0answers
53 views

Still looks bash

I've already changed shell to zsh, but my terminal still looks like bash. What I've done: Install Oh My ZSH via curl. Run cash -s /bin/zsh in terminal. They said once you restart the terminal you'...
0
votes
0answers
26 views

macOS: how to set a custom lock screen delay (from command-line)?

In MacOS, if I don't like the System Preference's provided options in the dropdown "Require password [...] after sleep or screen saver begins", is there a way to set it to a different value, ...
1
vote
0answers
21 views

Hide SSID from the list of available wifi networks in macOS?

Is there any way to hide particular SSID names from the list of available networks? Below command gives list of wifi networks, /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/...
1
vote
2answers
69 views

Using command line how to open a specific section of GUI System Preferences?

It is possible to open a specific section (sub section) of the GUI System Preferences via command line terminal? Example: If I want to open just the main System Preferences window, I just run open /...
0
votes
2answers
55 views

How do I write folder-agnostic shell script on Mac as I can do in Windows?

I would like to write a set of shell scripts which would execute smoothly on Mac disregarding where they are called from. I am currently struggling about how to implement this. On windows, I could ...
3
votes
1answer
88 views

Mac Terminal Padding

Is it possible to add window padding to Terminal.app? Here's how it looks currently ... and here's how I would like it to look ... iTerm2 with padding
9
votes
2answers
260 views

Pipe to mv command

I'm trying to move files from Terminal but only those from the results of a grep query. ls -l | grep -i s02 | mv What is the best way to complete the command above?
3
votes
1answer
18 views

Is there a way to suppress valid files beginning with dot (.) in a tar archive giving false errors and files?

I have a tar compressed archive created on a linux system that has valid files in a directory beginning with dot (.). When I extract that tar file on a Mac, tar thinks that the dotted file is a ...
3
votes
2answers
33 views

Homebrew uninstalling fails

I am trying to uninstall a cask using homebrew, but each time it fails due to (I believe) AppleScript failing to run. I believe this issue stems from my multiuser setup (I am a non admin). Error: ...
1
vote
0answers
14 views

How to restore Dock Icon Badges after killall Dock?

I need to run killall Dock in a script I use regularly, in order for it to work. Unfortunately all the badges in the Dock disappears when Dock is killed, and don't reappear until they're modified ...
4
votes
1answer
530 views

How can I make multiple directories in Mac OS terminal?

I'm trying to make multiple folders at once but when I press enter it says: mkdir: i/like: No such file or directory. I do this mkdir i/like/icecream I think I have the latest version of python. Any ...